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

[rhel5-branch] Use getDiskPart() from bootyutil.



So some code duplication and bugs are avoided.

Related: rhbz#572862
---
 fsset.py |   34 +++-------------------------------
 1 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/fsset.py b/fsset.py
index 54753a0..c958cdd 100644
--- a/fsset.py
+++ b/fsset.py
@@ -32,6 +32,7 @@ import lvm
 import types
 from flags import flags
 
+import bootyutil
 import rhpl
 from rhpl.translate import _, N_
 
@@ -3186,37 +3187,8 @@ def ext2FormatFilesystem(argList, messageFile, windowCreator, mntpoint):
 
     return 1
 
-# copy and paste job from booty/bootloaderInfo.py...
-def getDiskPart(dev):
-    cut = len(dev)
-    if (dev.startswith('rd/') or dev.startswith('ida/') or
-            dev.startswith('cciss/') or dev.startswith('sx8/') or
-            dev.startswith('mapper/')):
-        if dev[-2] == 'p':
-            cut = -1
-        elif dev[-3] == 'p':
-            cut = -2
-    else:
-        if dev[-2] in string.digits:
-            cut = -2
-        elif dev[-1] in string.digits:
-            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:
-        partNum = int(dev[cut:]) - 1
-    else:
-        partNum = None
-
-    return (name, partNum)
+# The code for getDiskPart() is already present in booty, delegate the call there.
+getDiskPart = bootyutil.getDiskPart
 
 def getExtFSFlagsFeatures(device):
 
-- 
1.7.3.3


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