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

Anne Mulhern amulhern at redhat.com
Mon Sep 8 21:52:15 UTC 2014





----- Original Message -----
> From: "Samantha N. Bueno" <sbueno+anaconda at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Monday, September 8, 2014 11:20:02 AM
> Subject: [master/rhel7-branch] Warn if software selection size exceeds	available space (#1010070)
> 
> 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 | 59
>  +++++++++++++++++++++++++++++++++++++--
>  1 file changed, 56 insertions(+), 3 deletions(-)
> 
> diff --git a/pyanaconda/ui/tui/hubs/summary.py
> b/pyanaconda/ui/tui/hubs/summary.py
> index 5302b86..6e144bf 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
>  from pyanaconda.ui.tui.hubs import TUIHub
>  from pyanaconda.flags import flags
>  from pyanaconda.errors import CmdlineError
> @@ -35,6 +36,11 @@ 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)
> +
> +        self._checker = FileSystemSpaceChecker(storage, payload)
> +
>      def setup(self, environment="anaconda"):
>          TUIHub.setup(self, environment=environment)
>  
> @@ -58,9 +64,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:")
>              + \
> @@ -78,6 +89,43 @@ class SummaryHub(TUIHub):
>          # installation option here
>          return _("  Please make your choice from above ['q' to quit | 'b' to
>          begin installation |\n  'r' to refresh]: ")
>  
> +    def refresh(self, args=None):
> +        TUIHub.refresh(self, args)
> +        cats_and_spokes = self._collectCategoriesAndSpokes()
> +        categories = cats_and_spokes.keys()
> +
> +        for c in sorted(categories, key=lambda c: c.title):
> +            obj = c()

obj and selectors seem to be unused in this method.

> +
> +            selectors = []
> +            for spokeClass in sorted(cats_and_spokes[c], key=lambda s:
> s.title):
> +                # Check if this spoke is to be shown in the supported
> environment
> +                if not any(spokeClass.should_run(environ, self.data) for
> environ in self._environs):
> +                    continue
> +
> +                # Create the new spokes and populate its UI with whatever
> data.
> +                # From here on, this Spoke will always exist.
> +                spoke = spokeClass(self.app, self.data, self.storage,
> self.payload, self.instclass)
> +
> +                # If a spoke is not showable, it is unreachable in the UI,
> so
> +                # just get rid of it
> +                if not spoke.showable:
> +                    del(spoke)
> +                    continue
> +
> +                # If a spoke is indirect, it is reachable but not directly
> from
> +                # the hub.
> +                if spoke.indirect:
> +                    spoke.initialize()
> +                    continue
> +
> +                spoke.initialize()
> +
> +                # If this is a ks install, attempt to execute any provided
> +                # ksdata now
> +                if flags.automatedInstall and spoke.ready and spoke.changed:
> +                    spoke.execute()
> +
>      def input(self, args, key):
>          """Handle user input. Numbers are used to show a spoke, the rest is
>          passed
>          to the higher level for processing."""
> @@ -95,6 +143,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
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

The patch commit message is about warning messages. I don't understand
why the biggest chunk of code is an all new refresh method that is
not about warning messages.

- mulhern


More information about the anaconda-patches mailing list