[PATCH 2/2] booty: Do not strip the trailing p from a devicename like mapper/isw_Vol0_tmp

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

 



While fixing bug 505205, I noticed that the code for removing the trailing p
in a name like: mapper/isw_Vol0p1 which becomes mapper/isw_Vol0p after cutting
is rather interesting, for example it will wrongly change the whole diskname
mapper/isw_Vol0_tmp to mapper/isw_Vol0_tm. This patch fixes this by removing
the trailing p as part of the partition cutting code instead of always removing
it.
---
 booty/util.py |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/booty/util.py b/booty/util.py
index 2b79730..48c3194 100644
--- a/booty/util.py
+++ b/booty/util.py
@@ -10,9 +10,9 @@ def getDiskPart(dev, storage):
                 path.startswith('mapper/') or path.startswith('mmcblk') or
                 path.startswith('md')):
             if dev[-2] == 'p':
-                cut = -1
-            elif dev[-3] == 'p' and dev[-2] in string.digits:
                 cut = -2
+            elif dev[-3] == 'p' and dev[-2] in string.digits:
+                cut = -3
         else:
             if dev[-2] in string.digits:
                 cut = -2
@@ -21,15 +21,11 @@ def getDiskPart(dev, storage):
 
     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
+        part = dev[cut:]
+        if part[0] == 'p':
+            part = part[1:]
+        partNum = int(part) - 1
     else:
         partNum = None
 
-- 
1.6.2.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux