summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig/cc_bootcmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/CloudConfig/cc_bootcmd.py')
-rw-r--r--cloudinit/CloudConfig/cc_bootcmd.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/CloudConfig/cc_bootcmd.py b/cloudinit/CloudConfig/cc_bootcmd.py
index fc925447..66c452e9 100644
--- a/cloudinit/CloudConfig/cc_bootcmd.py
+++ b/cloudinit/CloudConfig/cc_bootcmd.py
@@ -18,11 +18,13 @@
import cloudinit.util as util
import subprocess
import tempfile
+import os
from cloudinit.CloudConfig import per_always
frequency = per_always
-def handle(_name,cfg,cloud,log,_args):
- if not cfg.has_key("bootcmd"):
+
+def handle(_name, cfg, cloud, log, _args):
+ if "bootcmd" not in cfg:
return
try:
@@ -33,10 +35,10 @@ def handle(_name,cfg,cloud,log,_args):
except:
log.warn("failed to shellify bootcmd")
raise
-
+
try:
- env=os.environ.copy()
- env['INSTANCE_ID']=cloud.get_instance_id()
+ env = os.environ.copy()
+ env['INSTANCE_ID'] = cloud.get_instance_id()
subprocess.check_call(['/bin/sh'], env=env, stdin=tmpf)
tmpf.close()
except: