[master 11/30] Clear TUI source spoke errors that may have been leftover from a prior attempt. (#1192259)

KosiehBarter installerbot-noreply at redhat.com
Thu Jul 16 12:00:35 UTC 2015


From: "Samantha N. Bueno" <sbueno+anaconda at redhat.com>

This does a few things:
-- self.errors -> self._error in the TUI source spoke; and it is now
   just a boolean value instead of a list, same as in the GUI source
   spoke; any error messages that were previously being stored here in a
   list were never being shown anyway
-- gets rid of _update_summary() since that was never used
-- before attempting to apply a user's selection, clear any errors which
   may have been incurred from a prior attempt

Resolves: rhbz#1192259
---
 pyanaconda/ui/tui/spokes/source.py | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/pyanaconda/ui/tui/spokes/source.py b/pyanaconda/ui/tui/spokes/source.py
index 50c50b8..67043dd 100644
--- a/pyanaconda/ui/tui/spokes/source.py
+++ b/pyanaconda/ui/tui/spokes/source.py
@@ -63,7 +63,7 @@ def __init__(self, app, data, storage, payload, instclass):
         EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
         SourceSwitchHandler.__init__(self)
         self._ready = False
-        self.errors = []
+        self._error = False
         self._cdrom = None
 
     def initialize(self):
@@ -88,7 +88,7 @@ def _initialize(self):
         self._ready = True
 
     def _payload_error(self):
-        self.errors.append(payloadMgr.error)
+        self._error = True
 
     def _repo_status(self):
         """ Return a string describing repo url or lack of one. """
@@ -113,28 +113,19 @@ def showable(self):
 
     @property
     def status(self):
-        if self.errors:
+        if self._error:
             return _("Error setting up software source")
         elif not self.ready:
             return _("Processing...")
         else:
             return self._repo_status()
 
-    def _update_summary(self):
-        """ Update screen with a summary. Show errors if there are any. """
-        summary = (_("Repo URL set to: %s") % self._repo_status())
-
-        if self.errors:
-            summary = summary + "\n" + "\n".join(self.errors)
-
-        return summary
-
     @property
     def completed(self):
         if flags.automatedInstall and self.ready and not self.payload.baseRepo:
             return False
         else:
-            return not self.errors and self.ready and (self.data.method.method or self.payload.baseRepo)
+            return not self._error and self.ready and (self.data.method.method or self.payload.baseRepo)
 
     def refresh(self, args=None):
         EditTUISpoke.refresh(self, args)
@@ -198,7 +189,7 @@ def input(self, args, key):
                 # preliminary NFS source switch
                 self.set_source_nfs()
                 newspoke = SpecifyNFSRepoSpoke(self.app, self.data, self.storage,
-                                        self.payload, self.instclass, self._selection, self.errors)
+                                        self.payload, self.instclass, self._selection, self._error)
                 self.app.switch_screen_modal(newspoke)
                 self.apply()
                 self.close()
@@ -240,6 +231,10 @@ def apply(self):
         if flags.askmethod:
             flags.askmethod = False
 
+        # if we had any errors, e.g. from a previous attempt to set the source,
+        # clear them at this point
+        self._error = False
+
         payloadMgr.restartThread(self.storage, self.data, self.payload, self.instclass,
                 checkmount=False)
 
@@ -291,11 +286,11 @@ class SpecifyNFSRepoSpoke(EditTUISpoke, SourceSwitchHandler):
         Entry(N_("NFS mount options"), "opts", re.compile(".*$"), True)
     ]
 
-    def __init__(self, app, data, storage, payload, instclass, selection, errors):
+    def __init__(self, app, data, storage, payload, instclass, selection, error):
         EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
         SourceSwitchHandler.__init__(self)
         self.selection = selection
-        self.errors = errors
+        self._error = error
 
         nfs = self.data.method
         self.args = DataHolder(server="", opts=nfs.opts or "")
@@ -322,7 +317,7 @@ def apply(self):
             (self.data.method.server, self.data.method.dir) = self.args.server.split(":", 2)
         except ValueError as err:
             LOG.error("ValueError: %s", err)
-            self.errors.append(_("Failed to set up installation source. Check the source address."))
+            self._error = True
             return
 
         opts = self.args.opts or ""


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/c9531bf1ae581b7a30310ff1eff764f9b353b5b4


More information about the anaconda-patches mailing list