[master/rhel7-branch] Take 02: Warn if software selection size exceeds available space (#1010070)

Samantha N. Bueno sbueno+anaconda at redhat.com
Mon Sep 15 15:47:35 UTC 2014


Show a warning message to users if their software selection exceeds the
amount of space they have allocated for installation.

Resolves: rhbz#1010070
---
 pyanaconda/ui/tui/hubs/summary.py | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py
index 5302b86..c1b0dcf 100644
--- a/pyanaconda/ui/tui/hubs/summary.py
+++ b/pyanaconda/ui/tui/hubs/summary.py
@@ -20,6 +20,7 @@
 #                    Jesse Keating <jkeating at redhat.com>
 #
 
+from pyanaconda.ui.lib.space import FileSystemSpaceChecker, DirInstallSpaceChecker
 from pyanaconda.ui.tui.hubs import TUIHub
 from pyanaconda.flags import flags
 from pyanaconda.errors import CmdlineError
@@ -35,6 +36,14 @@ class SummaryHub(TUIHub):
     ## FIXME: this should be pulling data from somewhere, not just a static list
     categories = ["localization", "software", "system", "password"]
 
+    def __init__(self, app, data, storage, payload, instclass):
+        super(SummaryHub, self).__init__(app, data, storage, payload, instclass)
+
+        if not flags.dirInstall:
+            self._checker = FileSystemSpaceChecker(storage, payload)
+        else:
+            self._checker = DirInstallSpaceChecker(storage, payload)
+
     def setup(self, environment="anaconda"):
         TUIHub.setup(self, environment=environment)
 
@@ -58,9 +67,14 @@ class SummaryHub(TUIHub):
         incompleteSpokes = [spoke for spoke in self._keys.values()
                                       if spoke.mandatory and not spoke.completed]
 
-        if flags.automatedInstall and not incompleteSpokes:
-            self.close()
-            return None
+        # do a bit of final sanity checking, make sure pkg selection
+        # size < available fs space
+        if flags.automatedInstall:
+            if self._checker and not self._checker.check():
+                print(self._checker.error_message)
+            if not incompleteSpokes:
+                self.close()
+                return None
 
         if not flags.ksprompt:
             errtxt = _("The following mandatory spokes are not completed:") + \
@@ -95,6 +109,11 @@ class SummaryHub(TUIHub):
                     if not spoke.completed and spoke.mandatory:
                         print(_("Please complete all spokes before continuing"))
                         return False
+                # do a bit of final sanity checking, making sure pkg selection
+                # size < available fs space
+                if self._checker and not self._checker.check():
+                    print(self._checker.error_message)
+                    return False
                 if self.app._screens:
                     self.app.close_screen()
                     return True
-- 
1.9.3



More information about the anaconda-patches mailing list