[rhel7-branch][PATCH] Fix minimal install usage with incomplete kickstart (#1032066)

Vratislav Podzimek vpodzime at redhat.com
Thu Jan 9 10:32:26 UTC 2014


On Wed, 2014-01-08 at 18:29 +0100, Martin Kolman wrote:
> Make sure the user can select minimal install when installing
> with an incomplete kickstart that does not specify packages.
> For such incomplete kickstarts, we require the user to enter
> the software spoke and confirm a software environment.
> The users must be able to select any of the environments,
> including "minimal install", which is selected by default.
> 
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>  pyanaconda/ui/gui/spokes/software.py | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
> index b7725e0..a9a7496 100644
> --- a/pyanaconda/ui/gui/spokes/software.py
> +++ b/pyanaconda/ui/gui/spokes/software.py
> @@ -55,6 +55,10 @@ class SoftwareSelectionSpoke(NormalSpoke):
>          self._errorMsgs = None
>          self._tx_id = None
>          self._selectFlag = False
> +        # track if the spoke was visited at least once
> +        self._visited_once = False
> +        self._visited_once_done = False
> +        self._first_refresh_done = False
>  
>          self.selectedGroups = []
>          self.excludedGroups = []
> @@ -125,6 +129,27 @@ class SoftwareSelectionSpoke(NormalSpoke):
>  
>      @property
>      def changed(self):
> +        # we need to regard the first time user enters the spoke as changed=True,
> +        # otherwise the user would not be able to select minimal install when
> +        # installing with an incomplete kickstart (kickstart without packages)
> +        #
> +        # this is because:
> +        # - if users does not specify packages in kickstart, we require him
> +        #   to enter the software selection spoke and select/confirm an environment
> +        # - minimal install is the default option
> +        # - when the user enters the spoke, leaves the default option ticked
> +        #   and clicks the apply button, changed is False as the selection
> +        #   was not actually changed
> +        # - if changed is False, apply() is not called so the default option
> +        #   is not used and the spoke remains incomplete
> +
> +        if self._visited_once and not self._visited_once_done:
> +            self._visited_once_done = True
> +            return True
> +
> +        # this special changed behaviour needs to be done only once, 
> +        # subsequent visits should use the normal rules
> +
>          row = self._get_selected_environment()
>          if not row:
>              return True
> @@ -230,14 +255,23 @@ class SoftwareSelectionSpoke(NormalSpoke):
>      def _first_refresh(self):
>          try:
>              self.refresh()
> +            self._first_refresh_done = True
>              return True
>          except MetadataError:
>              hubQ.send_message(self.__class__.__name__, _("No installation source available"))
> +            self._first_refresh_done = True
>              return False
You can put that line in a finally: block I guess.

Wouldn't it be better to set environment to some special value in the
initialization of the spoke and then set it to the first environment on
the first visit? That would allow removing those visited/refreshed
flags, woudln't it?

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list