[PATCH 1/2] Handle cancellation of new container creation.
David Lehman
dlehman at redhat.com
Tue Sep 16 16:30:47 UTC 2014
Resolves: rhbz#1027224
---
pyanaconda/ui/gui/spokes/custom.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 546ac94..7a75e85 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -1901,6 +1901,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
fancy_set_sensitive(self._encryptCheckbox, True)
def run_container_editor(self, container=None, name=None):
+ """ Run container edit dialog and return True if changes were made. """
size = Size(0)
size_policy = self._device_container_size
if container:
@@ -1969,6 +1970,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._device_container_raid_level = dialog.raid_level
self._device_container_encrypted = dialog.encrypted
self._device_container_size = dialog.size_policy
+ return True
def _container_store_row(self, name, freeSpace=None):
if freeSpace is not None:
@@ -1982,7 +1984,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# pass the name along with any found vg since we could be modifying a
# vg that hasn't been instantiated yet
- self.run_container_editor(container=container, name=container_name)
+ if not self.run_container_editor(container=container, name=container_name):
+ return
log.debug("%s -> %s", container_name, self._device_container_name)
if container_name == self._device_container_name:
@@ -2049,9 +2052,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# run the vg editor dialog with a default name and disk set
hostname = self.data.network.hostname
name = self._storage_playground.suggestContainerName(hostname=hostname)
- self.run_container_editor(name=name)
+ new = self.run_container_editor(name=name)
for idx, data in enumerate(self._containerStore):
- if data[0] == new_text:
+ if new and data[0] == new_text:
c = self._storage_playground.devicetree.getDeviceByName(self._device_container_name)
freeSpace = getattr(c, "freeSpace", None)
row = self._container_store_row(self._device_container_name, freeSpace)
@@ -2059,6 +2062,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._containerStore.insert(idx, row)
combo.set_active(idx) # triggers a call to this method
return
+ elif not new and data[0] == self._device_container_name:
+ combo.set_active(idx)
+ return
else:
self._device_container_name = container_name
--
1.9.3
More information about the anaconda-patches
mailing list