diff options
author | Chris Cosby <ccosby@gmail.com> | 2014-12-03 01:13:52 -0500 |
---|---|---|
committer | Chris Cosby <ccosby@gmail.com> | 2014-12-03 01:13:52 -0500 |
commit | 91ccf1b55b5b79694449446b029dd7c4570517a5 (patch) | |
tree | 35a6454c4d6aabcf78100b46945b0fd144ac1f2e | |
parent | 9c2933d9cad323b786adc8338f045cb71cd258da (diff) | |
download | vyos-cloud-init-91ccf1b55b5b79694449446b029dd7c4570517a5.tar.gz vyos-cloud-init-91ccf1b55b5b79694449446b029dd7c4570517a5.zip |
Handle more possible ssh_pwauth values
Update ssh_pwauth handler to accept all values mentioned in
doc/examples/cloud-config.txt
-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 4ca85e21..fcfd3d1b 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: + util.logexc(log, 'Unrecognized value %r for ssh_pwauth' % cfg['ssh_pwauth']) + if change_pwauth: replaced_auth = False |