From 74763385b8f5b3e6f74a423aa726f0ea9332937c Mon Sep 17 00:00:00 2001 From: Ales Kozumplik Date: Fri, 13 May 2011 17:55:50 +0200 Subject: [booty rhel5-branch] Fix cutting of the partition 'p' in getDiskPart(). (#572862) Before it worked OK for 'mapper/mpath1p2' but it failed to separate the partition part from 'mapper/rootdevp1' (because the disk part contains no digits) This replaces the ancient part of the method with something simpler and hopefully more general (though it's hard to say it doesn't brake some other cases). --- bootyutil.py | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/bootyutil.py b/bootyutil.py index ea48c44..7b06fdb 100644 --- a/bootyutil.py +++ b/bootyutil.py @@ -35,13 +35,9 @@ def getDiskPart(dev): cut = -1 name = dev[:cut] - - # hack off the trailing 'p' from /dev/cciss/*, for example - if name[-1] == 'p': - for letter in name: - if letter not in string.letters and letter != "/": - name = name[:-1] - break + if cut < 0 and name[-1] == 'p': + # hack off the trailing 'p' if we found the partition part + name = name[:-1] if cut < 0: partNum = int(dev[cut:]) - 1 -- 1.7.3.3