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
This commit is contained in:
Ben Howard 2012-09-01 19:51:56 -04:00 committed by Scott Moser
commit 2735af8111
2 changed files with 8 additions and 4 deletions

View File

@ -53,14 +53,18 @@ def handle(_name, cfg, cloud, log, args):
user = cloud.distro.get_default_user() user = cloud.distro.get_default_user()
if 'users' in cfg: if 'users' in cfg:
user_zero = cfg['users'].keys()[0]
if user_zero != "default": user_zero = cfg['users'][0]
user = user_zero
if isinstance(user_zero, dict) and 'name' in user_zero:
user = user_zero['name']
if user: if user:
plist = "%s:%s" % (user, password) plist = "%s:%s" % (user, password)
else:
log.warn("No default or defined user to change password for.")
errors = [] errors = []
if plist: if plist:
plist_in = [] plist_in = []

View File

@ -31,5 +31,5 @@ class Distro(debian.Distro):
distro_name = 'ubuntu' distro_name = 'ubuntu'
default_user = 'ubuntu' default_user = 'ubuntu'
default_user_groups = ("adm,admin,audio,cdrom,dialout,floppy,video," default_user_groups = ("adm,audio,cdrom,dialout,floppy,video,"
"plugdev,dip,netdev,sudo") "plugdev,dip,netdev,sudo")