summaryrefslogtreecommitdiff
path: root/cloudinit/transforms
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 07:36:29 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 07:36:29 -0700
commit8d3c67458842d0c03d28f79cb02d19e32136f7ef (patch)
tree72cf37609201f248d8780119869c6f0281921024 /cloudinit/transforms
parent76f2e0e51dc29b7737ed3aee540749191465ae58 (diff)
downloadvyos-cloud-init-8d3c67458842d0c03d28f79cb02d19e32136f7ef.tar.gz
vyos-cloud-init-8d3c67458842d0c03d28f79cb02d19e32136f7ef.zip
Only set an env variable for instance id if we actually got one.
Diffstat (limited to 'cloudinit/transforms')
-rw-r--r--cloudinit/transforms/cc_bootcmd.py4
1 files changed, 3 insertions, 1 deletions
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: