[PATCH] Give a more correct error for missing groups/packages on exclude (#1060194).

Chris Lumens clumens at redhat.com
Thu Feb 13 17:03:45 UTC 2014


---
 pyanaconda/errors.py               | 34 ++++++++++++++++++++++++++--------
 pyanaconda/packaging/yumpayload.py |  8 ++++----
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
index 738a329..6259063 100644
--- a/pyanaconda/errors.py
+++ b/pyanaconda/errors.py
@@ -179,10 +179,19 @@ class ErrorHandler(object):
 
     def _noSuchGroupHandler(self, *args, **kwargs):
         group = args[0]
-        message = _("You have specified that the group '%s' should be "
-                    "installed.  This group does not exist.  Would you like "
-                    "to skip this group and continue with "
-                    "installation?") % group
+        adding = args[1]
+
+        if adding:
+            message = _("You have specified that the group '%s' should be "
+                        "installed.  This group does not exist.  Would you like "
+                        "to skip this group and continue with "
+                        "installation?") % group
+        else:
+            message = _("You have specified that the group '%s' should be "
+                        "excluded from installation.  This group does not exist.  "
+                        "Would you like to skip this group and continue with "
+                        "installation?") % group
+
         if self.ui.showYesNoQuestion(message):
             return ERROR_CONTINUE
         else:
@@ -190,10 +199,19 @@ class ErrorHandler(object):
 
     def _noSuchPackageHandler(self, *args, **kwargs):
         package = args[0]
-        message = _("You have specified that the package '%s' should be "
-                    "installed.  This package does not exist.  Would you "
-                    "like to skip this package and continue with "
-                    "installation?") % package
+        adding = args[1]
+
+        if adding:
+            message = _("You have specified that the package '%s' should be "
+                        "installed.  This package does not exist.  Would you "
+                        "like to skip this package and continue with "
+                        "installation?") % package
+        else:
+            message = _("You have specified that the package '%s' should be "
+                        "excluded from installation.  This package does not exist.  "
+                        "Would you like to skip this package and continue with "
+                        "installation?") % package
+
         if self.ui.showYesNoQuestion(message):
             return ERROR_CONTINUE
         else:
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 43ce236..4872484 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -1179,11 +1179,11 @@ reposdir=%s
                 else:
                     self._yum._ts_save_file = None
 
-    def _handleMissing(self, exn):
+    def _handleMissing(self, exn, adding=True):
         if self.data.packages.handleMissing == KS_MISSING_IGNORE:
             return
 
-        if errorHandler.cb(exn, str(exn)) == ERROR_RAISE:
+        if errorHandler.cb(exn, str(exn), adding) == ERROR_RAISE:
             # The progress bar polls kind of slowly, thus installation could
             # still continue for a bit before the quit message is processed.
             # Let's sleep forever to prevent any further actions and wait for
@@ -1228,13 +1228,13 @@ reposdir=%s
             try:
                 self._deselectYumPackage(package)
             except NoSuchPackage as e:
-                self._handleMissing(e)
+                self._handleMissing(e, adding=False)
 
         for group in self.data.packages.excludedGroupList:
             try:
                 self._deselectYumGroup(group.name)
             except NoSuchGroup as e:
-                self._handleMissing(e)
+                self._handleMissing(e, adding=False)
 
         self._select_kernel_package()
         self.selectRequiredPackages()
-- 
1.8.3.1



More information about the anaconda-patches mailing list