summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-29 13:49:55 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-29 13:49:55 -0700
commit1779967ec7aa4e6ebfdd176b8b98edb6f3470242 (patch)
tree31d5cdd50cec519537be7a0a8c869018649bc47e
parent25df1844285a48cd4ba0226c9c65e66973374845 (diff)
downloadvyos-cloud-init-1779967ec7aa4e6ebfdd176b8b98edb6f3470242.tar.gz
vyos-cloud-init-1779967ec7aa4e6ebfdd176b8b98edb6f3470242.zip
Just log the number of commands 'shellified'
-rw-r--r--cloudinit/util.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 3cf51e65..3ff3835a 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1303,21 +1303,24 @@ def shellify(cmdlist, add_header=True):
if add_header:
content += "#!/bin/sh\n"
escaped = "%s%s%s%s" % ("'", '\\', "'", "'")
+ cmds_made = 0
for args in cmdlist:
- # if the item is a list, wrap all items in single tick
- # if its not, then just write it directly
+ # If the item is a list, wrap all items in single tick.
+ # If its not, then just write it directly.
if isinstance(args, list):
fixed = []
for f in args:
fixed.append("'%s'" % (str(f).replace("'", escaped)))
content = "%s%s\n" % (content, ' '.join(fixed))
+ cmds_made += 1
elif isinstance(args, (str, basestring)):
content = "%s%s\n" % (content, args)
+ cmds_made += 1
else:
raise RuntimeError(("Unable to shellify type %s"
" which is not a list or string")
% (obj_name(args)))
- LOG.debug("Shellified %s to %s", cmdlist, content)
+ LOG.debug("Shellified %s commands.", cmds_made)
return content