--- pyanaconda/cmdline.py | 5 --- pyanaconda/storage/devicetree.py | 80 ----------------------------------- tests/pyanaconda_test/cmdline_test.py | 7 --- 3 files changed, 92 deletions(-)
diff --git a/pyanaconda/cmdline.py b/pyanaconda/cmdline.py index 7c11ccf..310ec38 100644 --- a/pyanaconda/cmdline.py +++ b/pyanaconda/cmdline.py @@ -127,11 +127,6 @@ class InstallInterface(InstallInterfaceBase): errtxt += "\n(passphraseEntryWindow: '%s')" % (device,) raise RuntimeError(errtxt)
- def getLUKSPassphrase(self, passphrase = "", isglobal = False): - errtxt = _("Can't have a question in command line mode!") - errtxt += "\n(getLUKSPassphrase)" - raise RuntimeError(errtxt) - def enableNetwork(self): errtxt = "(enableNetwork)\n" errtxt += _("Can't have a question in command line mode!") diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py index 9d902aa..e1ff351 100644 --- a/pyanaconda/storage/devicetree.py +++ b/pyanaconda/storage/devicetree.py @@ -54,86 +54,6 @@ _ = lambda x: gettext.ldgettext("anaconda", x) import logging log = logging.getLogger("storage")
-def getLUKSPassphrase(intf, device, passphrases): - """ Obtain a passphrase for a LUKS encrypted block device. - - The format's mapping name must already be set and the backing - device must already be set up before calling this function. - - If successful, this function leaves the device mapped. - - Return value is the passphrase string, if obtained - - Either or both can be None, depending on the outcome. - """ - if device.format.type != "luks": - # this function only works on luks devices - raise ValueError("not a luks device") - - if not device.status: - # the device should have already been set up - raise RuntimeError("device is not set up") - - if device.format.status: - # the device is already mapped - raise RuntimeError("device is already mapped") - - if not device.format.configured and passphrases: - for passphrase in passphrases: - device.format.passphrase = passphrase - - try: - device.format.setup() - except CryptoError as e: - device.format.passphrase = None - else: - # we've opened the device so we're done. - return passphrase - - if not intf: - return None - - buttons = [_("Back"), _("Continue")] - passphrase_incorrect = False - while True: - if passphrase_incorrect: - # TODO: add a flag to passphraseEntryWindow to say the last - # passphrase was incorrect so try again - passphrase_incorrect = False - passphrase = intf.passphraseEntryWindow(device.name) - if not passphrase: - rc = intf.messageWindow(_("Confirm"), - _("Are you sure you want to skip " - "entering a passphrase for device " - "%s?\n\n" - "If you skip this step the " - "device's contents will not " - "be available during " - "installation.") % device.name, - type = "custom", - default = 0, - custom_buttons = buttons) - if rc == 0: - continue - else: - passphrase = None - log.info("skipping passphrase for %s" % (device.name,)) - break - - device.format.passphrase = passphrase - - try: - device.format.setup() - except CryptoError as e: - device.format.passphrase = None - passphrase_incorrect = True - else: - # we've opened the device so we're done. - break - - return passphrase - - class DeviceTree(object): """ A quasi-tree that represents the devices in the system.
diff --git a/tests/pyanaconda_test/cmdline_test.py b/tests/pyanaconda_test/cmdline_test.py index e6a0a33..17cb16a 100644 --- a/tests/pyanaconda_test/cmdline_test.py +++ b/tests/pyanaconda_test/cmdline_test.py @@ -134,13 +134,6 @@ class CmdLineTest(mock.TestCase): self.assertRaises(Exception, intf.passphraseEntryWindow, DEVICE) sys.stdout.close() self.assertTrue(DEVICE in self.fs[self.TMP_STDOUT]) - - def installinterface_getlukspassphrase_test(self): - import pyanaconda.cmdline - pyanaconda.cmdline.time.sleep = mock.Mock(side_effect=Exception) - - intf = pyanaconda.cmdline.InstallInterface() - self.assertRaises(Exception, intf.getLUKSPassphrase, 'foo')
def installinterface_enablenetwork_test(self): import pyanaconda.cmdline
This is another attempt to fix some of the confusion of having both a Continue and a Done button on the same screen. To clear it up, I've completely removed the Continue button and made the Done button do everything that Continue used to do. This makes the storage spoke a little more standalone instead of the first screen in a series. --- pyanaconda/ui/gui/spokes/storage.glade | 26 ++++---------------------- pyanaconda/ui/gui/spokes/storage.py | 16 ++++++++++------ 2 files changed, 14 insertions(+), 28 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade index 43e2791..047abbf 100644 --- a/pyanaconda/ui/gui/spokes/storage.glade +++ b/pyanaconda/ui/gui/spokes/storage.glade @@ -951,26 +951,6 @@ <property name="row_spacing">6</property> <property name="column_spacing">6</property> <child> - <object class="GtkButton" id="continue_button"> - <property name="label" translatable="yes">_Continue</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="halign">end</property> - <property name="valign">end</property> - <property name="hexpand">True</property> - <property name="use_underline">True</property> - <property name="xalign">1</property> - <signal name="clicked" handler="on_continue_clicked" swapped="no"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">2</property> - </packing> - </child> - <child> <object class="GtkButton" id="summary_button"> <property name="label" translatable="yes">_Full disk summary and options...</property> <property name="visible">True</property> @@ -1016,13 +996,15 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="halign">end</property> - <property name="xalign">0</property> + <property name="valign">end</property> + <property name="hexpand">True</property> + <property name="xalign">1</property> <property name="draw_indicator">True</property> <property name="use_underline">True</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="top_attach">2</property> <property name="width">1</property> <property name="height">1</property> </packing> diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py index 0324ef3..6efd00d 100644 --- a/pyanaconda/ui/gui/spokes/storage.py +++ b/pyanaconda/ui/gui/spokes/storage.py @@ -584,7 +584,6 @@ class StorageSpoke(NormalSpoke, StorageChecker): else: self.clear_info()
- self.builder.get_object("continue_button").set_sensitive(count > 0) self.builder.get_object("summary_label").set_sensitive(count > 0)
def _update_disk_list(self): @@ -634,7 +633,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
return rc
- def on_continue_clicked(self, button): + def on_back_clicked(self, button): # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: @@ -658,6 +657,11 @@ class StorageSpoke(NormalSpoke, StorageChecker): disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum(Size(spec="%f MB" % d.size) for d in disks)
+ # No disks selected? The user wants to back out of the storage spoke. + if not disks: + NormalSpoke.on_back_clicked(self, button) + return + # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. @@ -713,14 +717,14 @@ class StorageSpoke(NormalSpoke, StorageChecker):
self.passphrase = dialog.passphrase
- gtk_call_once(self.window.emit, "button-clicked") + NormalSpoke.on_back_clicked(self, button) elif rc == dialog.RESPONSE_CANCEL: # stay on this spoke - print "user chose to continue disk selection" + return elif rc == dialog.RESPONSE_MODIFY_SW: # go to software spoke self.skipTo = "SoftwareSelectionSpoke" - gtk_call_once(self.window.emit, "button-clicked") + NormalSpoke.on_back_clicked(self, button) elif rc == dialog.RESPONSE_RECLAIM: self.autopart = not dialog.custom self.autoPartType = dialog.autoPartType @@ -732,7 +736,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
if dialog.custom: self.skipTo = "CustomPartitioningSpoke" - gtk_call_once(self.window.emit, "button-clicked") + NormalSpoke.on_back_clicked(self, button) else: if self.encrypted: dialog = PassphraseDialog(self.data)
ACK to these 2
anaconda-patches@lists.fedorahosted.org