summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2012-08-20 14:52:31 -0600
committerBen Howard <ben.howard@canonical.com>2012-08-20 14:52:31 -0600
commit336ddbe13bdfc729495f5bfb8cc89b4360916157 (patch)
tree3d551bde0b99b0db8c1c33f9bbd7e9e22acebb2f /cloudinit/util.py
parent4540821caa31dc9ed0bedf521cd36975ddafebfa (diff)
downloadvyos-cloud-init-336ddbe13bdfc729495f5bfb8cc89b4360916157.tar.gz
vyos-cloud-init-336ddbe13bdfc729495f5bfb8cc89b4360916157.zip
Added "userless" mode to cloud-init for handling the creation of the
users and the default user on Ubuntu. cloudinit/config/cc_users_groups.py: new cloud-config module for creating users and groups on instance initialization. - Creates users and group - Sets "user" directive used in ssh_import_id cloudinit/config/cc_ssh_import_id.py: module will rely upon users_groups for setting the default user. Removed assumption of 'ubuntu' user. cloudinit/distros/__init__.py: Added new abstract methods for getting and creating the default user. cloudinit/distros/ubuntu.py: Defined abstract methods for getting and and creating the default 'ubuntu' user on Ubuntu instances. cloudinit/util.py: Added ability to hide command run through util.subp to prevent the commands from showing in the logs. Used by user_groups cloud-config module. config/cloud.cfg: Removed "user: ubuntu" directive and replaced with new user-less syntax. doc/examples/cloud-config.txt: Documented the creation of users and groups.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index a8c0cceb..0fbf9832 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1329,12 +1329,18 @@ def delete_dir_contents(dirname):
del_file(node_fullpath)
-def subp(args, data=None, rcs=None, env=None, capture=True, shell=False):
+def subp(args, data=None, rcs=None, env=None, capture=True, shell=False, hidden=False):
if rcs is None:
rcs = [0]
try:
- LOG.debug(("Running command %s with allowed return codes %s"
- " (shell=%s, capture=%s)"), args, rcs, shell, capture)
+
+ if not hidden:
+ LOG.debug(("Running command %s with allowed return codes %s"
+ " (shell=%s, capture=%s)"), args, rcs, shell, capture)
+ else:
+ LOG.debug(("Running hidden command to protect sensative output "
+ " Calling function: %s" ), hidden)
+
if not capture:
stdout = None
stderr = None