[PATCH 1/4] Make the code changing an existing device more compact

Vratislav Podzimek vpodzime at redhat.com
Mon Apr 7 15:51:49 UTC 2014


This improves readability of the code in the _save_right_side method which is
very long and complex.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/custom.py | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index f8d5926..0f5bb1e 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -926,9 +926,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
 
             self.clear_errors()
 
-            #
-            # Handle change of device type and change of container
-            #
             if changed_device_type or changed_container:
                 # remove the current device
                 self._destroy_device(device)
@@ -936,7 +933,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                     # the removal failed. don't continue.
                     log.error("device removal failed")
                     return
-
                 removed_device = True
             else:
                 removed_device = False
@@ -944,17 +940,17 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             with ui_storage_logger():
                 succ = self._try_replace_device(selector, removed_device,
                                                 new_device_info, old_device_info)
-                if not succ:
-                    # failed, nothing more to be done
-                    return
+            if not succ:
+                # failed, nothing more to be done
+                return
 
             self._update_device_in_selectors(device, selector.device)
             self._devices = self._storage_playground.devices
 
-            # update size props of all btrfs devices' selectors
+            # update size properties and the right side
             self._update_size_props()
-
             self._populate_right_side(selector)
+
             log.debug("leaving save_right_side")
             return
 
-- 
1.9.0



More information about the anaconda-patches mailing list