From 794cdb0f612e7714d83c28b6adcea750df7d7014 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 20 Dec 2011 11:35:41 -0500 Subject: [PATCH] add INSTANCE_ID to environment of bootcmd scripts --- cloudinit/CloudConfig/cc_bootcmd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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")