summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-08-22 22:35:18 -0400
committerScott Moser <smoser@ubuntu.com>2012-08-22 22:35:18 -0400
commitd05dd3963eda608df0b14042e8548d42c860835e (patch)
tree6f237cf0492268a19c3c8961fb2f8a5fb9317ee2
parent2916a7be3bf416651458dc6640d67bd9ca173f0d (diff)
downloadvyos-cloud-init-d05dd3963eda608df0b14042e8548d42c860835e.tar.gz
vyos-cloud-init-d05dd3963eda608df0b14042e8548d42c860835e.zip
fix duplicate flags being passed to useradd
Fix bug here: adduser_cmd = ['useradd', name] x_adduser_cmd = adduser_cmd is different than x_adduser_cmd = ['useradd', name] The problem was they referenced the same list, and we were doubly appending.
-rw-r--r--cloudinit/distros/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 478e3993..8da9a0b5 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -218,7 +218,7 @@ class Distro(object):
LOG.debug("Creating name %s" % name)
adduser_cmd = ['useradd', name]
- x_adduser_cmd = adduser_cmd
+ x_adduser_cmd = ['useradd', name]
# Since we are creating users, we want to carefully validate the
# inputs. If something goes wrong, we can end up with a system
@@ -254,7 +254,7 @@ class Distro(object):
else:
x_adduser_cmd.extend([adduser_opts[option], 'REDACTED'])
- if option in adduser_opts_flags and value:
+ elif option in adduser_opts_flags and value:
adduser_cmd.append(adduser_opts_flags[option])
x_adduser_cmd.append(adduser_opts_flags[option])