From 91ccf1b55b5b79694449446b029dd7c4570517a5 Mon Sep 17 00:00:00 2001 From: Chris Cosby Date: Wed, 3 Dec 2014 01:13:52 -0500 Subject: Handle more possible ssh_pwauth values Update ssh_pwauth handler to accept all values mentioned in doc/examples/cloud-config.txt --- cloudinit/config/cc_set_passwords.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'cloudinit/config/cc_set_passwords.py') 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 -- cgit v1.2.3 From c3ece3129228ad7f2206d049af0f4635da8e8eb5 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 14 Mar 2016 14:24:27 -0400 Subject: fix long line --- cloudinit/config/cc_set_passwords.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cloudinit/config/cc_set_passwords.py') diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index ff3b9ba5..58e1b713 100644 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -118,8 +118,8 @@ def handle(_name, cfg, cloud, log, args): log.debug('Leaving auth line unchanged') change_pwauth = False else: - util.logexc(log, 'Unrecognized value %r for ssh_pwauth' % cfg['ssh_pwauth']) - + msg = 'Unrecognized value %s for ssh_pwauth' % cfg['ssh_pwauth'] + util.logexc(log, msg) if change_pwauth: replaced_auth = False -- cgit v1.2.3