From 8d3c67458842d0c03d28f79cb02d19e32136f7ef Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 16 Jun 2012 07:36:29 -0700 Subject: Only set an env variable for instance id if we actually got one. --- cloudinit/transforms/cc_bootcmd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cloudinit') diff --git a/cloudinit/transforms/cc_bootcmd.py b/cloudinit/transforms/cc_bootcmd.py index 80afb5e7..0c45a307 100644 --- a/cloudinit/transforms/cc_bootcmd.py +++ b/cloudinit/transforms/cc_bootcmd.py @@ -45,7 +45,9 @@ def handle(name, cfg, cloud, log, _args): try: env = os.environ.copy() - env['INSTANCE_ID'] = cloud.get_instance_id() + iid = cloud.get_instance_id() + if iid: + env['INSTANCE_ID'] = str(iid) cmd = ['/bin/sh', tmpf.name] util.subp(cmd, env=env, capture=False) except: -- cgit v1.2.3