[PATCH] Don't abuse ksdata to default to locked password (#860029)

Martin Sivak msivak at redhat.com
Tue Oct 2 10:22:47 UTC 2012


The default lock in initialize was wrong, but the _lock variable is not needed.. we still want to show the proper state we got from kickstart - and unlocked root with empty password is a valid use case.

The logic should be outside of spokes, because we need to share it between all user interfaces and firstboot. So we should set the default values of self.data somewhere very early.

Martin

----- Original Message -----
> When doing kickstarts we don't actually go through the apply() block,
> which is what would change the ksdata.lock from True to False.
>  Instead
> use a _lock attribute to reflect that we default to being locked.
> ---
>  pyanaconda/ui/gui/spokes/password.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/password.py
> b/pyanaconda/ui/gui/spokes/password.py
> index 672c44c..8134172 100644
> --- a/pyanaconda/ui/gui/spokes/password.py
> +++ b/pyanaconda/ui/gui/spokes/password.py
> @@ -56,7 +56,7 @@ class PasswordSpoke(NormalSpoke):
>      def initialize(self):
>          NormalSpoke.initialize(self)
>          # Set the rootpw to locked by default, setting a password is
>          optional
> -        self.data.rootpw.lock = True
> +        self._lock = True
>          # place holders for the text boxes
>          self.pw = self.builder.get_object("pw")
>          self.confirm = self.builder.get_object("confirm")
> @@ -77,7 +77,7 @@ class PasswordSpoke(NormalSpoke):
>      def status(self):
>          if self._error:
>              return _("Error setting root password")
> -        elif self.data.rootpw.lock:
> +        elif self._lock and not self.data.rootpw.password:
>              return _("Root account is disabled")
>          else:
>              return _("Root password is set")
> @@ -87,9 +87,11 @@ class PasswordSpoke(NormalSpoke):
>              self.data.rootpw.password =
>              cryptPassword(self._password)
>              self.data.rootpw.isCrypted = True
>              self.data.rootpw.lock = False
> +            self._lock = False
>          else:
>              # Blank password case, disable the account
>              self.data.rootpw.lock = True
> +            self._lock = True
>              self.data.rootpw.password = ''
>              self.data.rootpw.isCrypted = False
>  
> --
> 1.7.11.4
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 


More information about the anaconda-patches mailing list