diff options
Diffstat (limited to 'cloudinit/CloudConfig/cc_bootcmd.py')
-rw-r--r-- | cloudinit/CloudConfig/cc_bootcmd.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cloudinit/CloudConfig/cc_bootcmd.py b/cloudinit/CloudConfig/cc_bootcmd.py index 5a9e4356..f584da02 100644 --- a/cloudinit/CloudConfig/cc_bootcmd.py +++ b/cloudinit/CloudConfig/cc_bootcmd.py @@ -1,8 +1,10 @@ # vi: ts=4 expandtab # # Copyright (C) 2009-2011 Canonical Ltd. +# Copyright (C) 2012 Hewlett-Packard Development Company, L.P. # # Author: Scott Moser <scott.moser@canonical.com> +# Author: Juerg Haefliger <juerg.haefliger@hp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as @@ -18,11 +20,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 +37,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: |