summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-01-17 15:30:04 -0500
committerScott Moser <smoser@ubuntu.com>2014-01-17 15:30:04 -0500
commit605335f4732246ef89b94dcc542e73f13fdef1c9 (patch)
tree7e0ac9e33408102a04342db5b54ee0a520ef64ec /cloudinit/util.py
parent98fd17c55b637f4e1d136c954567c1d9b23e6c20 (diff)
parent1729b161c7569ec60ac6102a046e0b8c22457b7c (diff)
downloadvyos-cloud-init-605335f4732246ef89b94dcc542e73f13fdef1c9.tar.gz
vyos-cloud-init-605335f4732246ef89b94dcc542e73f13fdef1c9.zip
initial vendordata support
This adds the ability for a datasource to provide "vendordata". The difference here is that vendordata is from the vendor (cloud provider) where user-data is from the user. By enabling this channel, the vendor can have input on how the instance is set up without modifying or needing to understand the user-data. vendordata is generally consumed exactly like user-data, but the user has the ability to disable its consumption. The only datasource supporting this at the moment is SmartOS.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index a37172dc..3ce54f28 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -608,18 +608,28 @@ def del_dir(path):
shutil.rmtree(path)
-def runparts(dirp, skip_no_exist=True):
+def runparts(dirp, skip_no_exist=True, exe_prefix=None):
if skip_no_exist and not os.path.isdir(dirp):
return
failed = []
attempted = []
+
+ if exe_prefix is None:
+ prefix = []
+ elif isinstance(exe_prefix, str):
+ prefix = [str(exe_prefix)]
+ elif isinstance(exe_prefix, list):
+ prefix = exe_prefix
+ else:
+ raise TypeError("exe_prefix must be None, str, or list")
+
for exe_name in sorted(os.listdir(dirp)):
exe_path = os.path.join(dirp, exe_name)
if os.path.isfile(exe_path) and os.access(exe_path, os.X_OK):
attempted.append(exe_path)
try:
- subp([exe_path], capture=False)
+ subp(prefix + [exe_path], capture=False)
except ProcessExecutionError as e:
logexc(LOG, "Failed running %s [%s]", exe_path, e.exit_code)
failed.append(e)