summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-12-20 11:35:41 -0500
committerScott Moser <smoser@ubuntu.com>2011-12-20 11:35:41 -0500
commitcc915378bd187c8db63b6c65b2e9c7510b8578f6 (patch)
treec648d567b57f942571d6140204e1844b52cf6e7f
parent13015ef25fa7e748e916c99f083e338b28861a18 (diff)
downloadvyos-cloud-init-cc915378bd187c8db63b6c65b2e9c7510b8578f6.tar.gz
vyos-cloud-init-cc915378bd187c8db63b6c65b2e9c7510b8578f6.zip
add INSTANCE_ID to environment of bootcmd scripts
-rw-r--r--cloudinit/CloudConfig/cc_bootcmd.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/CloudConfig/cc_bootcmd.py b/cloudinit/CloudConfig/cc_bootcmd.py
index 11e9938c..5a9e4356 100644
--- a/cloudinit/CloudConfig/cc_bootcmd.py
+++ b/cloudinit/CloudConfig/cc_bootcmd.py
@@ -35,7 +35,9 @@ def handle(name,cfg,cloud,log,args):
raise
try:
- subprocess.check_call(['/bin/sh'], stdin=tmpf)
+ env=os.environ.copy()
+ env['INSTANCE_ID']=cloud.get_instance_id()
+ subprocess.check_call(['/bin/sh'], env=env, stdin=tmpf)
tmpf.close()
except:
log.warn("failed to run commands from bootcmd")