diff options
author | Scott Moser <smoser@brickies.net> | 2017-03-10 10:18:18 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-03-10 10:35:23 -0500 |
commit | 021ed9c960484dcb45941d48139ec86c2ce1f248 (patch) | |
tree | fc261597b326ea00e70051d8f1abc4a28002e407 /cloudinit | |
parent | 7f2b51054a5defec4c04fc40026bda7dd29f69fe (diff) | |
download | vyos-cloud-init-021ed9c960484dcb45941d48139ec86c2ce1f248.tar.gz vyos-cloud-init-021ed9c960484dcb45941d48139ec86c2ce1f248.zip |
fix regression when no chpasswd/list was provided.
This regression was caused by my rework of Sergio's branch.
The change now still works when there is no chpasswd/list provided.
Diffstat (limited to 'cloudinit')
-rwxr-xr-x | cloudinit/config/cc_set_passwords.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index fa343a7a..f36f7745 100755 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -89,14 +89,15 @@ def handle(_name, cfg, cloud, log, args): if 'chpasswd' in cfg: chfg = cfg['chpasswd'] - if isinstance(chfg['list'], list): - log.debug("Handling input for chpasswd as list.") - plist = util.get_cfg_option_list(chfg, 'list', plist) - else: - log.debug("Handling input for chpasswd as multiline string.") - plist = util.get_cfg_option_str(chfg, 'list', plist) - if plist: - plist = plist.spitlines() + if 'list' in chfg and chfg['list']: + if isinstance(chfg['list'], list): + log.debug("Handling input for chpasswd as list.") + plist = util.get_cfg_option_list(chfg, 'list', plist) + else: + log.debug("Handling input for chpasswd as multiline string.") + plist = util.get_cfg_option_str(chfg, 'list', plist) + if plist: + plist = plist.splitlines() expire = util.get_cfg_option_bool(chfg, 'expire', expire) |