[rhel7-branch 1/1] Catch NoSuchGroup error (#1245296)

bcl installerbot-noreply at redhat.com
Tue Jul 21 23:33:12 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

self.environment can be None if you start with no repository setup.
Catch it and show 'Nothing selected'. Also added a catch-all for
environmentDescription() which can raise NoSuchGroup and display
'Selected environment is not valid'.

Resolves: rhbz#1245296
---
 pyanaconda/ui/gui/spokes/software.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 25eb596..12894af 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -281,15 +281,20 @@ def status(self):
             # we have no packages section in the kickstart
             else:
                 return _("Nothing selected")
+        else:
+            if not self.environment_valid:
+                # selected environment is not valid, this can happen when a valid environment
+                # is selected (by default, manually or from kickstart) and then the installation
+                # source is switched to one where the selected environment is no longer valid
+                return _("Selected environment is not valid")
+            elif not self.environment:
+                return _("Nothing selected")
 
-        if not flags.automatedInstall and not self.environment_valid:
-            # selected environment is not valid, this can happen when a valid environment
-            # is selected (by default, manually or from kickstart) and then the installation
-            # source is switched to one where the selected environment is no longer valid
+        try:
+            return self.payload.environmentDescription(self.environment)[0]
+        except NoSuchGroup:
             return _("Selected environment is not valid")
 
-        return self.payload.environmentDescription(self.environment)[0]
-
     def initialize(self):
         NormalSpoke.initialize(self)
         threadMgr.add(AnacondaThread(name=constants.THREAD_SOFTWARE_WATCHER,


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


More information about the anaconda-patches mailing list