[PATCH 3/3] Restore list-harddrives output to what users expect (#654436)

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

 



The list-harddrives command was changed to list partitions as well as
the whole disks.  Disks would only be shown if they had a valid
disklabel.  This is incorrect.  The command is meant to show what disks
are in the system and their size, usually so people can set up kickstart
partitioning commands or partition the disk on their own.

This patch changes the output from:

    /dev/sda 61057
    /dev/sdb 476940
    /dev/sdc 30524
    /dev/sda1 300
    /dev/sda2 60751
    /dev/sdb1 476937
    /dev/sdc1 30520

To:

    sda 61057.3359375
    sdb 476940.023438
    sdc 30524.0

Which is the way the command has worked in previous releases.
---
 command-stubs/list-harddrives-stub |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/command-stubs/list-harddrives-stub b/command-stubs/list-harddrives-stub
index 2d9e225..4025186 100755
--- a/command-stubs/list-harddrives-stub
+++ b/command-stubs/list-harddrives-stub
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import os
 import sys
 import parted
 import _ped
@@ -26,20 +27,12 @@ def main(argv):
     lst = set()
 
     for dev in filter(lambda d: d.type != parted.DEVICE_DM, parted.getAllDevices()):
-        try:
-            disk = parted.Disk(dev)
-        except _ped.DiskLabelException:
-            continue
-
-        for part in disk.partitions:
-            lst.add("%s %s" % (part.path, int(part.getSize())))
-
-        print("%s %s" % (dev.path, int(dev.getSize())))
+        lst.add((os.path.basename(dev.path), dev.getSize()))
 
     lst = list(lst)
     lst.sort()
-    for entry in lst:
-        print entry
+    for dev, size in lst:
+        print dev, size
 
 if __name__ == "__main__":
     main(sys.argv)
-- 
1.7.3.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