[PATCH] Check that the addon selection state exists before reading it

Vratislav Podzimek vpodzime at redhat.com
Fri Feb 28 07:50:53 UTC 2014


On Thu, 2014-02-27 at 17:27 -0500, David Shea wrote:
> An addon state may not be present if switching from an installation
> source with a different set of groups.
> ---
>  pyanaconda/ui/gui/spokes/software.py | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
> index bfae3ae..6302827 100644
> --- a/pyanaconda/ui/gui/spokes/software.py
> +++ b/pyanaconda/ui/gui/spokes/software.py
> @@ -309,13 +309,16 @@ class SoftwareSelectionSpoke(NormalSpoke):
>      def _addAddon(self, grp):
>          (name, desc) = self.payload.groupDescription(grp)
>  
> -        # If the add-on was previously selected by the user, select it
> -        if self._addonStates[grp] == self._ADDON_SELECTED:
> -            selected = True
> -        # If the add-on was previously de-selected by the user, de-select it
> -        elif self._addonStates[grp] == self._ADDON_DESELECTED:
> -            selected = False
> -        # Otherwise, use the default state
> +        if grp in self._addonStates:
> +            # If the add-on was previously selected by the user, select it
> +            if self._addonStates[grp] == self._ADDON_SELECTED:
> +                selected = True
> +            # If the add-on was previously de-selected by the user, de-select it
> +            elif self._addonStates[grp] == self._ADDON_DESELECTED:
> +                selected = False
> +            # Otherwise, use the default state
> +            else:
> +                selected = self.payload.environmentOptionIsDefault(self.environment, grp)
>          else:
>              selected = self.payload.environmentOptionIsDefault(self.environment, grp)
ACK.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list