diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-03-21 22:31:15 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-03-21 22:31:15 -0400 |
commit | 5fa9d4c3acbb4f7bf98a8eea7e121f3bc71ad7e0 (patch) | |
tree | 8f79ffffaa497c6efbc3104c1078f9d356034411 /cloudinit/config/cc_set_passwords.py | |
parent | 7a22e352b2f87636554d9787f60cd3168f3d77bc (diff) | |
parent | 4f2065ad569355d5d0bc54176bde6b8e55047341 (diff) | |
download | vyos-cloud-init-5fa9d4c3acbb4f7bf98a8eea7e121f3bc71ad7e0.tar.gz vyos-cloud-init-5fa9d4c3acbb4f7bf98a8eea7e121f3bc71ad7e0.zip |
merge from trunk
Diffstat (limited to 'cloudinit/config/cc_set_passwords.py')
-rw-r--r-- | cloudinit/config/cc_set_passwords.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index 0c315361..58e1b713 100644 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -45,8 +45,6 @@ def handle(_name, cfg, cloud, log, args): password = util.get_cfg_option_str(cfg, "password", None) expire = True - pw_auth = "no" - change_pwauth = False plist = None if 'chpasswd' in cfg: @@ -104,11 +102,24 @@ def handle(_name, cfg, cloud, log, args): change_pwauth = False pw_auth = None if 'ssh_pwauth' in cfg: - change_pwauth = True if util.is_true(cfg['ssh_pwauth']): + change_pwauth = True pw_auth = 'yes' - if util.is_false(cfg['ssh_pwauth']): + elif util.is_false(cfg['ssh_pwauth']): + change_pwauth = True pw_auth = 'no' + elif str(cfg['ssh_pwauth']).lower() == 'unchanged': + log.debug('Leaving auth line unchanged') + change_pwauth = False + elif not str(cfg['ssh_pwauth']).strip(): + log.debug('Leaving auth line unchanged') + change_pwauth = False + elif not cfg['ssh_pwauth']: + log.debug('Leaving auth line unchanged') + change_pwauth = False + else: + msg = 'Unrecognized value %s for ssh_pwauth' % cfg['ssh_pwauth'] + util.logexc(log, msg) if change_pwauth: replaced_auth = False |