summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig/cc_runcmd.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-02-07 17:03:34 -0500
committerScott Moser <smoser@ubuntu.com>2011-02-07 17:03:34 -0500
commite285b1614b00c5689ac71ec9afcfa83d996b22c0 (patch)
tree54f9df3a9620def7a87106b8d618c00c35a2007e /cloudinit/CloudConfig/cc_runcmd.py
parent00ac0cfe971b1891b722455615df2230b0382567 (diff)
downloadvyos-cloud-init-e285b1614b00c5689ac71ec9afcfa83d996b22c0.tar.gz
vyos-cloud-init-e285b1614b00c5689ac71ec9afcfa83d996b22c0.zip
add 'bootcmd' like 'runcmd' to cloud-config syntax for running things early
Diffstat (limited to 'cloudinit/CloudConfig/cc_runcmd.py')
-rw-r--r--cloudinit/CloudConfig/cc_runcmd.py15
1 files changed, 1 insertions, 14 deletions
diff --git a/cloudinit/CloudConfig/cc_runcmd.py b/cloudinit/CloudConfig/cc_runcmd.py
index afa7a441..f030980a 100644
--- a/cloudinit/CloudConfig/cc_runcmd.py
+++ b/cloudinit/CloudConfig/cc_runcmd.py
@@ -22,21 +22,8 @@ def handle(name,cfg,cloud,log,args):
if not cfg.has_key("runcmd"):
return
outfile="%s/runcmd" % cloud.get_ipath('scripts')
-
- content="#!/bin/sh\n"
- escaped="%s%s%s%s" % ( "'", '\\', "'", "'" )
try:
- for args in cfg["runcmd"]:
- # 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) )
- else:
- content="%s%s\n" % ( content, str(args) )
-
+ content = util.shellify(cfg["runcmd"])
util.write_file(outfile,content,0700)
except:
log.warn("failed to open %s for runcmd" % outfile)