[master/rhel7-branch] Re-apply disk selection on error in TUi storage. (#1056316)

Samantha N. Bueno sbueno+anaconda at redhat.com
Tue Feb 18 19:18:26 UTC 2014


This copies over some more logic from the GUI storage spoke that should
make error handling a bit more sane.

Resolves: rhbz#1056316
---
 pyanaconda/ui/tui/spokes/storage.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index b4d40f1..c9a356a 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -283,6 +283,15 @@ class StorageSpoke(NormalTUISpoke):
         # user may have set up before now.
         self.storage.config.clearNonExistent = self.data.autopart.autopart
 
+    def _applyDiskSelection(self, use_names):
+        onlyuse = use_names[:]
+        for disk in (d for d in self.storage.disks if d.name in onlyuse):
+            onlyuse.extend(d.name for d in disk.ancestors
+                           if d.name not in onlyuse)
+
+        self.data.ignoredisk.onlyuse = onlyuse
+        self.data.clearpart.drives = use_names[:]
+
     def execute(self):
         print(_("Generating updated storage configuration"))
         try:
@@ -297,6 +306,8 @@ class StorageSpoke(NormalTUISpoke):
             self.storage.config.update(self.data)
             self.storage.autoPartType = self.data.clearpart.type
             self.storage.reset()
+            # now set ksdata back to the user's specified config
+            self._applyDiskSelection(self.selected_disks)
             self._ready = True
         except BootLoaderError as e:
             log.error("BootLoader setup failed: %s", e)
-- 
1.8.3.1



More information about the anaconda-patches mailing list