[anaconda][master][PATCH] Sort disks by name when checking disk selection

Vratislav Podzimek vpodzime at redhat.com
Tue Apr 14 12:11:48 UTC 2015


Not sure about what Python 2 makes up to sort the disks, but Python 3 complains
about DiskDevice objects being unsortable. Making the use of name as the key
explicit is however good no matter which python we are using.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/lib/disks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyanaconda/ui/lib/disks.py b/pyanaconda/ui/lib/disks.py
index 0febf85..9264360 100644
--- a/pyanaconda/ui/lib/disks.py
+++ b/pyanaconda/ui/lib/disks.py
@@ -106,7 +106,7 @@ def checkDiskSelection(storage, selected_disks):
     errors = []
     for name in selected_disks:
         selected = storage.devicetree.getDeviceByName(name, hidden=True)
-        related = sorted(storage.devicetree.getRelatedDisks(selected))
+        related = sorted(storage.devicetree.getRelatedDisks(selected), key=lambda d: d.name)
         missing = [r.name for r in related if r.name not in selected_disks]
         if missing:
             errors.append(P_("You selected disk %(selected)s, which contains "
-- 
2.1.0



More information about the anaconda-patches mailing list