Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def __init__(self, data, storage, payload, instclass):
        super().__init__(data, storage, payload, instclass)
        self.title = N_("Installation")

        if not conf.target.is_directory:
            self._checker = FileSystemSpaceChecker(storage, payload)
        else:
            self._checker = DirInstallSpaceChecker(storage, payload)
Exemplo n.º 3
0
    def __init__(self, data, storage, payload, instclass):
        super().__init__(data, storage, payload, instclass)
        self.title = N_("Installation")

        if not flags.dirInstall:
            self._checker = FileSystemSpaceChecker(storage, payload)
        else:
            self._checker = DirInstallSpaceChecker(storage, payload)
Exemplo n.º 4
0
    def __init__(self, data, storage, payload):
        super().__init__(data, storage, payload)
        self.title = N_("Installation")

        if not conf.target.is_directory:
            self._checker = FileSystemSpaceChecker(payload)
        else:
            self._checker = DirInstallSpaceChecker(payload)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    def __init__(self, data, storage, payload):
        """Create a new Hub instance.

           The arguments this base class accepts defines the API that Hubs
           have to work with.  A Hub does not get free reign over everything
           in the anaconda class, as that would be a big mess.  Instead, a
           Hub may count on the following:

           ksdata       -- An instance of a pykickstart Handler object.  The
                           Hub uses this to populate its UI with defaults
                           and to pass results back after it has run.
           storage      -- An instance of storage.Storage.  This is useful for
                           determining what storage devices are present and how
                           they are configured.
           payload      -- An instance of a payload.Payload subclass.  This
                           is useful for displaying and selecting packages to
                           install, and in carrying out the actual installation.
        """
        super().__init__(data, storage, payload)
        self._show_details_callback = None

        if not conf.target.is_directory:
            self._checker = FileSystemSpaceChecker(payload)
        else:
            self._checker = DirInstallSpaceChecker(payload)

        # Add a continue-clicked handler
        self.window.connect("continue-clicked", self._on_continue_clicked)

        # Add an info-bar-clicked handler
        self.window.connect("info-bar-clicked", self._on_info_bar_clicked)
Exemplo n.º 7
0
    def __init__(self, data, storage, payload, instclass):
        """Create a new Hub instance.

           The arguments this base class accepts defines the API that Hubs
           have to work with.  A Hub does not get free reign over everything
           in the anaconda class, as that would be a big mess.  Instead, a
           Hub may count on the following:

           ksdata       -- An instance of a pykickstart Handler object.  The
                           Hub uses this to populate its UI with defaults
                           and to pass results back after it has run.
           storage      -- An instance of storage.Storage.  This is useful for
                           determining what storage devices are present and how
                           they are configured.
           payload      -- An instance of a packaging.Payload subclass.  This
                           is useful for displaying and selecting packages to
                           install, and in carrying out the actual installation.
           instclass    -- An instance of a BaseInstallClass subclass.  This
                           is useful for determining distribution-specific
                           installation information like default package
                           selections and default partitioning.
        """
        super(SummaryHub, self).__init__(data, storage, payload, instclass)

        if not flags.dirInstall:
            self._checker = FileSystemSpaceChecker(storage, payload)
        else:
            self._checker = DirInstallSpaceChecker(storage, payload)
Exemplo n.º 8
0
class SummaryHub(TUIHub):
    """
       .. inheritance-diagram:: SummaryHub
          :parts: 3
    """
    helpFile = "SummaryHub.txt"

    def __init__(self, data, storage, payload, instclass):
        super().__init__(data, storage, payload, instclass)
        self.title = N_("Installation")

        if not conf.target.is_directory:
            self._checker = FileSystemSpaceChecker(storage, payload)
        else:
            self._checker = DirInstallSpaceChecker(storage, payload)

    def setup(self, args="anaconda"):
        environment = args
        should_schedule = TUIHub.setup(self, environment)
        if not should_schedule:
            return False

        if flags.automatedInstall:
            sys.stdout.write(_("Starting automated install"))
            sys.stdout.flush()
            spokes = self._spokes.values()
            while not all(spoke.ready for spoke in spokes):
                # Catch any asynchronous events (like storage crashing)
                loop = App.get_event_loop()
                loop.process_signals()
                sys.stdout.write('.')
                sys.stdout.flush()
                time.sleep(1)

            print('')
            for spoke in spokes:
                if spoke.changed:
                    spoke.execute()

        return True

    # override the prompt so that we can skip user input on kickstarts
    # where all the data is in hand.  If not in hand, do the actual prompt.
    def prompt(self, args=None):
        incomplete_spokes = [spoke for spoke in self._spokes.values()
                            if spoke.mandatory and not spoke.completed]

        # Kickstart space check failure either stops the automated install or
        # raises an error when using cmdline mode.
        #
        # For non-cmdline, prompt for input but continue to treat it as an
        # automated install. The spokes (in particular software selection,
        # which expects an environment for interactive install) will continue
        # to behave the same, so the user can hit 'b' at the prompt and ignore
        # the warning.
        if flags.automatedInstall and not incomplete_spokes:

            # Check the available space.
            if flags.ksprompt and self._checker and not self._checker.check():

                # Space is not ok.
                print(self._checker.error_message)
                log.error(self._checker.error_message)

                # Unset the checker so everything passes next time.
                self._checker = None

                # TRANSLATORS: 'b' to begin installation
                print(_("Enter '%s' to ignore the warning and attempt to install anyway.") %
                        # TRANSLATORS: 'b' to begin installation
                        C_("TUI|Spoke Navigation", "b")
                        )
            else:
                # Space is ok and spokes are complete, continue.
                self.close()
                return None

        # cmdline mode and incomplete spokes raises and error
        if not flags.ksprompt and incomplete_spokes:
            errtxt = _("The following mandatory spokes are not completed:") + \
                     "\n" + "\n".join(spoke.title for spoke in incomplete_spokes)
            log.error("CmdlineError: %s", errtxt)
            raise CmdlineError(errtxt)

        # if we ever need to halt the flow of a ks install to prompt users for
        # input, flip off the automatedInstall flag -- this way installation
        # does not automatically proceed once all spokes are complete, and a
        # user must confirm they want to begin installation
        if incomplete_spokes:
            flags.automatedInstall = False

        # override the default prompt since we want to offer the 'b' to begin
        # installation option here
        prompt = super().prompt(args)
        # this screen cannot be closed
        prompt.remove_option(Prompt.CONTINUE)
        # TRANSLATORS: 'b' to begin installation
        prompt.add_option(C_("TUI|Spoke Navigation", "b"), _("to begin installation"))
        return prompt

    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."""
        if self._container.process_user_input(key):
            return InputState.PROCESSED
        else:
            # If we get a continue, check for unfinished spokes.  If unfinished
            # don't continue
            # TRANSLATORS: 'b' to begin installation
            if key == C_('TUI|Spoke Navigation', 'b'):
                for spoke in self._spokes.values():
                    if not spoke.completed and spoke.mandatory:
                        print(_("Please complete all spokes before continuing"))
                        return InputState.DISCARDED
                # 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 InputState.DISCARDED

                return InputState.PROCESSED_AND_CLOSE
            # TRANSLATORS: 'c' to continue
            elif key == C_('TUI|Spoke Navigation', 'c'):
                # Kind of a hack, but we want to ignore if anyone presses 'c'
                # which is the global TUI key to close the current screen
                return InputState.DISCARDED
            else:
                return super().input(args, key)
Exemplo n.º 9
0
class SummaryHub(TUIHub):
    title = N_("Installation")

    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"):
        should_schedule = TUIHub.setup(self, environment=environment)
        if not should_schedule:
            return False

        if flags.automatedInstall:
            sys.stdout.write(_("Starting automated install"))
            sys.stdout.flush()
            spokes = self._keys.values()
            while not all(spoke.ready for spoke in spokes):
                # Catch any asyncronous events (like storage crashing)
                self._app.process_events()
                sys.stdout.write('.')
                sys.stdout.flush()
                time.sleep(1)

            print('')
            for spoke in spokes:
                if spoke.changed:
                    spoke.execute()

        return True

    # override the prompt so that we can skip user input on kickstarts
    # where all the data is in hand.  If not in hand, do the actual prompt.
    def prompt(self, args=None):
        incompleteSpokes = [
            spoke for spoke in self._keys.values()
            if spoke.mandatory and not spoke.completed
        ]

        # Kickstart space check failure either stops the automated install or
        # raises an error when using cmdline mode.
        #
        # For non-cmdline, prompt for input but continue to treat it as an
        # automated install. The spokes (in particular software selection,
        # which expects an environment for interactive install) will continue
        # to behave the same, so the user can hit 'b' at the prompt and ignore
        # the warning.
        if flags.automatedInstall and self._checker and not self._checker.check(
        ):
            print(self._checker.error_message)
            log.error(self._checker.error_message)

            # Unset the checker so everything passes next time
            self._checker = None

            if not flags.ksprompt:
                return None
            else:
                # TRANSLATORS: 'b' to begin installation
                print(
                    _("Enter '%s' to ignore the warning and attempt to install anyway."
                      ) %
                    # TRANSLATORS: 'b' to begin installation
                    C_("TUI|Spoke Navigation", "b"))
        elif flags.automatedInstall and not incompleteSpokes:
            # Space is ok and spokes are complete, continue
            self.close()
            return None

        # cmdline mode and incomplete spokes raises and error
        if not flags.ksprompt and incompleteSpokes:
            errtxt = _("The following mandatory spokes are not completed:") + \
                     "\n" + "\n".join(spoke.title for spoke in incompleteSpokes)
            log.error("CmdlineError: %s", errtxt)
            raise CmdlineError(errtxt)

        # if we ever need to halt the flow of a ks install to prompt users for
        # input, flip off the automatedInstall flag -- this way installation
        # does not automatically proceed once all spokes are complete, and a
        # user must confirm they want to begin installation
        if incompleteSpokes:
            flags.automatedInstall = False

        # override the default prompt since we want to offer the 'b' to begin
        # installation option here
        return _(
            "  Please make your choice from above ['%(quit)s' to quit | '%(begin)s' to begin installation |\n  '%(refresh)s' to refresh]: "
        ) % {
            # TRANSLATORS: 'q' to quit
            'quit': C_('TUI|Spoke Navigation', 'q'),
            # TRANSLATORS: 'b' to begin installation
            'begin': C_('TUI|Spoke Navigation', 'b'),
            # TRANSLATORS: 'r' to refresh
            'refresh': C_('TUI|Spoke Navigation', 'r')
        }

    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."""
        try:
            number = int(key)
            self.app.switch_screen_with_return(self._keys[number])
            return None

        except (ValueError, KeyError):
            # If we get a continue, check for unfinished spokes.  If unfinished
            # don't continue
            # TRANSLATORS: 'b' to begin installation
            if key == C_('TUI|Spoke Navigation', 'b'):
                for spoke in self._spokes.values():
                    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
            # TRANSLATORS: 'c' to continue
            elif key == C_('TUI|Spoke Navigation', 'c'):
                # Kind of a hack, but we want to ignore if anyone presses 'c'
                # which is the global TUI key to close the current screen
                return False
            else:
                return super(SummaryHub, self).input(args, key)
Exemplo n.º 10
0
class SummaryHub(TUIHub):
    """
       .. inheritance-diagram:: SummaryHub
          :parts: 3
    """
    helpFile = "SummaryHub.txt"

    def __init__(self, data, storage, payload, instclass):
        super().__init__(data, storage, payload, instclass)
        self.title = N_("Installation")

        if not conf.target.is_directory:
            self._checker = FileSystemSpaceChecker(storage, payload)
        else:
            self._checker = DirInstallSpaceChecker(storage, payload)

    def setup(self, args="anaconda"):
        environment = args
        should_schedule = TUIHub.setup(self, environment)
        if not should_schedule:
            return False

        if flags.automatedInstall:
            sys.stdout.write(_("Starting automated install"))
            sys.stdout.flush()
            spokes = self._spokes.values()
            while not all(spoke.ready for spoke in spokes):
                # Catch any asynchronous events (like storage crashing)
                loop = App.get_event_loop()
                loop.process_signals()
                sys.stdout.write('.')
                sys.stdout.flush()
                time.sleep(1)

            print('')
            for spoke in spokes:
                if spoke.changed:
                    spoke.execute()

        return True

    # override the prompt so that we can skip user input on kickstarts
    # where all the data is in hand.  If not in hand, do the actual prompt.
    def prompt(self, args=None):
        incomplete_spokes = [
            spoke for spoke in self._spokes.values()
            if spoke.mandatory and not spoke.completed
        ]

        # Kickstart space check failure either stops the automated install or
        # raises an error when using cmdline mode.
        #
        # For non-cmdline, prompt for input but continue to treat it as an
        # automated install. The spokes (in particular software selection,
        # which expects an environment for interactive install) will continue
        # to behave the same, so the user can hit 'b' at the prompt and ignore
        # the warning.
        if flags.automatedInstall and not incomplete_spokes:

            # Check the available space.
            if flags.ksprompt and self._checker and not self._checker.check():

                # Space is not ok.
                print(self._checker.error_message)
                log.error(self._checker.error_message)

                # Unset the checker so everything passes next time.
                self._checker = None

                # TRANSLATORS: 'b' to begin installation
                print(
                    _("Enter '%s' to ignore the warning and attempt to install anyway."
                      ) %
                    # TRANSLATORS: 'b' to begin installation
                    C_("TUI|Spoke Navigation", "b"))
            else:
                # Space is ok and spokes are complete, continue.
                self.close()
                return None

        # cmdline mode and incomplete spokes raises and error
        if not flags.ksprompt and incomplete_spokes:
            errtxt = _("The following mandatory spokes are not completed:") + \
                     "\n" + "\n".join(spoke.title for spoke in incomplete_spokes)
            log.error("CmdlineError: %s", errtxt)
            raise CmdlineError(errtxt)

        # if we ever need to halt the flow of a ks install to prompt users for
        # input, flip off the automatedInstall flag -- this way installation
        # does not automatically proceed once all spokes are complete, and a
        # user must confirm they want to begin installation
        if incomplete_spokes:
            flags.automatedInstall = False

        # override the default prompt since we want to offer the 'b' to begin
        # installation option here
        prompt = super().prompt(args)
        # this screen cannot be closed
        prompt.remove_option(Prompt.CONTINUE)
        # TRANSLATORS: 'b' to begin installation
        prompt.add_option(C_("TUI|Spoke Navigation", "b"),
                          _("to begin installation"))
        return prompt

    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."""
        if self._container.process_user_input(key):
            return InputState.PROCESSED
        else:
            # If we get a continue, check for unfinished spokes.  If unfinished
            # don't continue
            # TRANSLATORS: 'b' to begin installation
            if key == C_('TUI|Spoke Navigation', 'b'):
                for spoke in self._spokes.values():
                    if not spoke.completed and spoke.mandatory:
                        print(
                            _("Please complete all spokes before continuing"))
                        return InputState.DISCARDED
                # 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 InputState.DISCARDED

                return InputState.PROCESSED_AND_CLOSE
            # TRANSLATORS: 'c' to continue
            elif key == C_('TUI|Spoke Navigation', 'c'):
                # Kind of a hack, but we want to ignore if anyone presses 'c'
                # which is the global TUI key to close the current screen
                return InputState.DISCARDED
            else:
                return super().input(args, key)
Exemplo n.º 11
0
class SummaryHub(TUIHub):
    title = N_("Installation")

    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"):
        should_schedule = TUIHub.setup(self, environment=environment)
        if not should_schedule:
            return False

        if flags.automatedInstall:
            sys.stdout.write(_("Starting automated install"))
            sys.stdout.flush()
            spokes = self._keys.values()
            while not all(spoke.ready for spoke in spokes):
                sys.stdout.write('.')
                sys.stdout.flush()
                time.sleep(1)

            print('')
            for spoke in spokes:
                if spoke.changed:
                    spoke.execute()

        return True

    # override the prompt so that we can skip user input on kickstarts
    # where all the data is in hand.  If not in hand, do the actual prompt.
    def prompt(self, args=None):
        incompleteSpokes = [
            spoke for spoke in self._keys.values()
            if spoke.mandatory and not spoke.completed
        ]

        # 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 flags.ksprompt:
            for spoke in incompleteSpokes:
                log.info("kickstart installation stopped for info: %s",
                         spoke.title)
        else:
            errtxt = _("The following mandatory spokes are not completed:") + \
                     "\n" + "\n".join(spoke.title for spoke in incompleteSpokes)
            log.error("CmdlineError: %s", errtxt)
            raise CmdlineError(errtxt)

        # override the default prompt since we want to offer the 'b' to begin
        # installation option here
        return _(
            "  Please make your choice from above ['q' to quit | 'b' to begin installation |\n  'r' to refresh]: "
        )

    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."""
        try:
            number = int(key)
            self.app.switch_screen_with_return(self._keys[number])
            return None

        except (ValueError, KeyError):
            # If we get a continue, check for unfinished spokes.  If unfinished
            # don't continue
            # TRANSLATORS: 'b' to begin installation
            if key == C_('TUI|Spoke Navigation', 'b'):
                for spoke in self._spokes.values():
                    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
            # TRANSLATORS: 'c' to continue
            elif key == C_('TUI|Spoke Navigation', 'c'):
                # Kind of a hack, but we want to ignore if anyone presses 'c'
                # which is the global TUI key to close the current screen
                return False
            else:
                super(SummaryHub, self).input(args, key)
Exemplo n.º 12
0
class SummaryHub(TUIHub):
    """
       .. inheritance-diagram:: SummaryHub
          :parts: 3
    """
    title = N_("Installation")

    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"):
        should_schedule = TUIHub.setup(self, environment=environment)
        if not should_schedule:
            return False

        if flags.automatedInstall:
            sys.stdout.write(_("Starting automated install"))
            sys.stdout.flush()
            spokes = self._keys.values()
            while not all(spoke.ready for spoke in spokes):
                sys.stdout.write('.')
                sys.stdout.flush()
                time.sleep(1)

            print('')
            for spoke in spokes:
                if spoke.changed:
                    spoke.execute()

        return True

    # override the prompt so that we can skip user input on kickstarts
    # where all the data is in hand.  If not in hand, do the actual prompt.
    def prompt(self, args=None):
        incompleteSpokes = [spoke for spoke in self._keys.values()
                                      if spoke.mandatory and not spoke.completed]

        # 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 flags.ksprompt:
            for spoke in incompleteSpokes:
                log.info("kickstart installation stopped for info: %s", spoke.title)
        else:
            errtxt = _("The following mandatory spokes are not completed:") + \
                     "\n" + "\n".join(spoke.title for spoke in incompleteSpokes)
            log.error("CmdlineError: %s", errtxt)
            raise CmdlineError(errtxt)

        # if we ever need to halt the flow of a ks install to prompt users for
        # input, flip off the automatedInstall flag -- this way installation
        # does not automatically proceed once all spokes are complete, and a
        # user must confirm they want to begin installation
        flags.automatedInstall = False

        # override the default prompt since we want to offer the 'b' to begin
        # installation option here
        return _("  Please make your choice from above ['%(quit)s' to quit | '%(begin)s' to begin installation |\n  '%(refresh)s' to refresh]: ") % {
            # TRANSLATORS: 'q' to quit
            'quit': C_('TUI|Spoke Navigation', 'q'),
            # TRANSLATORS: 'b' to begin installation
            'begin': C_('TUI|Spoke Navigation', 'b'),
            # TRANSLATORS: 'r' to refresh
            'refresh': C_('TUI|Spoke Navigation', 'r')
        }

    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."""
        try:
            number = int(key)
            self.app.switch_screen_with_return(self._keys[number])
            return None

        except (ValueError, KeyError):
            # If we get a continue, check for unfinished spokes.  If unfinished
            # don't continue
            # TRANSLATORS: 'b' to begin installation
            if key == C_('TUI|Spoke Navigation', 'b'):
                for spoke in self._spokes.values():
                    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
            # TRANSLATORS: 'c' to continue
            elif key == C_('TUI|Spoke Navigation', 'c'):
                # Kind of a hack, but we want to ignore if anyone presses 'c'
                # which is the global TUI key to close the current screen
                return False
            else:
                return super(SummaryHub, self).input(args, key)