summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2010-06-18 00:35:20 -0400
committerScott Moser <smoser@ubuntu.com>2010-06-18 00:35:20 -0400
commit9b1f260f2ba305da9405d88867fec4f0e838681e (patch)
treead3f6110be86eee02dd19aae427c463def6740fa
parent17fabe47dcbbe6b2180e73cac6211f7394d61a8a (diff)
downloadvyos-cloud-init-9b1f260f2ba305da9405d88867fec4f0e838681e.tar.gz
vyos-cloud-init-9b1f260f2ba305da9405d88867fec4f0e838681e.zip
add the instance-id to the environment as INSTANCE_ID for boothooks
passing the instance-id of this instance to a boothook will give it the unique id that is needed to implement run-once-per-instance.
-rw-r--r--cloudinit/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py
index b0ee5fe8..04beca1e 100644
--- a/cloudinit/__init__.py
+++ b/cloudinit/__init__.py
@@ -439,7 +439,9 @@ class CloudInit:
filepath = "%s/%s" % (boothooks_dir,filename)
util.write_file(filepath, payload, 0700)
try:
- ret = subprocess.check_call([filepath])
+ env=os.environ.copy()
+ env['INSTANCE_ID']= self.datasource.get_instance_id()
+ ret = subprocess.check_call([filepath], env=env)
except subprocess.CalledProcessError as e:
log.error("boothooks script %s returned %i" %
(filepath,e.returncode))