From 603bdecc5aaa34043379aa4311c271d52dfe61e8 Mon Sep 17 00:00:00 2001 From: Alex Sirbu Date: Wed, 2 Mar 2016 09:15:42 +0000 Subject: Added the hashed_passwd argument for the function create_user, which uses the already implemented functionality of changing the password with a hashed string, but which wasn't used anywhere. --- cloudinit/distros/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cloudinit') diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 8167c594..6778c93a 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -393,6 +393,10 @@ class Distro(object): if 'plain_text_passwd' in kwargs and kwargs['plain_text_passwd']: self.set_passwd(name, kwargs['plain_text_passwd']) + # Set password if hashed password is provided and non-empty + if 'hashed_passwd' in kwargs and kwargs['hashed_passwd']: + self.set_passwd(name, kwargs['hashed_passwd'], True) + # Default locking down the account. 'lock_passwd' defaults to True. # lock account unless lock_password is False. if kwargs.get('lock_passwd', True): -- cgit v1.2.3 From 921728d42731091f849d21dbef0920b84c559480 Mon Sep 17 00:00:00 2001 From: Alex Sirbu Date: Wed, 2 Mar 2016 09:57:05 +0000 Subject: Used keyword for parameter in order to make it clearer what it represents. --- cloudinit/distros/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cloudinit') diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 6778c93a..fec18cd2 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -395,7 +395,7 @@ class Distro(object): # Set password if hashed password is provided and non-empty if 'hashed_passwd' in kwargs and kwargs['hashed_passwd']: - self.set_passwd(name, kwargs['hashed_passwd'], True) + self.set_passwd(name, kwargs['hashed_passwd'], hashed=True) # Default locking down the account. 'lock_passwd' defaults to True. # lock account unless lock_password is False. -- cgit v1.2.3