[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[booty rhel5-branch] Fix cutting of the partiotion 'p' in getDiskPart().



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]