summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_set_passwords.py
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2012-09-01 19:51:56 -0400
committerScott Moser <smoser@ubuntu.com>2012-09-01 19:51:56 -0400
commit47a643296f6656bfda1ea13b5bc98dd4b60d7852 (patch)
tree31a7672cf4304a8103f6ac5df422611e62b80aea /cloudinit/config/cc_set_passwords.py
parent27118e7406237510ca56e969aa1b6d9152c8afbf (diff)
parent5988d5987982a60e13a37639d93ee08ffeb71ffd (diff)
downloadvyos-cloud-init-47a643296f6656bfda1ea13b5bc98dd4b60d7852.tar.gz
vyos-cloud-init-47a643296f6656bfda1ea13b5bc98dd4b60d7852.zip
remove 'admin' group for ubuntu user, fix change password
The admin group is deprecated in 12.04, so this removes the ubuntu user from that group (by default). The second change here is to fix the 'set_password' for the 'password' cloud-config. if 'password' is set in cloud_config, then * if 'users' is given, it applies to user[0] * if 'users' is not given, then it applies to the distro default user LP: #1044553
Diffstat (limited to 'cloudinit/config/cc_set_passwords.py')
-rw-r--r--cloudinit/config/cc_set_passwords.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
index 7d0fbd9f..a017e6b6 100644
--- a/cloudinit/config/cc_set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
@@ -53,14 +53,18 @@ def handle(_name, cfg, cloud, log, args):
user = cloud.distro.get_default_user()
if 'users' in cfg:
- user_zero = cfg['users'].keys()[0]
- if user_zero != "default":
- user = user_zero
+ user_zero = cfg['users'][0]
+
+ if isinstance(user_zero, dict) and 'name' in user_zero:
+ user = user_zero['name']
if user:
plist = "%s:%s" % (user, password)
+ else:
+ log.warn("No default or defined user to change password for.")
+
errors = []
if plist:
plist_in = []