summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: