summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:23:32 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:23:32 -0700
commita1f20dff76b00c7502f005c2b597f49c89cc2a09 (patch)
treed7a1811801c69d53329c7edb57c21a4087f4e098 /cloudinit
parent8c227a784b948b98d35a386da5d203bd54ea35e5 (diff)
downloadvyos-cloud-init-a1f20dff76b00c7502f005c2b597f49c89cc2a09.tar.gz
vyos-cloud-init-a1f20dff76b00c7502f005c2b597f49c89cc2a09.zip
Check instance id against none, and not just empty/false/0/none since 0 or empty might be valid
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/handlers/boot_hook.py2
-rw-r--r--cloudinit/stages.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/cloudinit/handlers/boot_hook.py b/cloudinit/handlers/boot_hook.py
index fa675f09..456b8020 100644
--- a/cloudinit/handlers/boot_hook.py
+++ b/cloudinit/handlers/boot_hook.py
@@ -63,7 +63,7 @@ class BootHookPartHandler(handlers.Handler):
filepath = self._write_part(payload, filename)
try:
env = os.environ.copy()
- if self.instance_id:
+ if self.instance_id is not None:
env['INSTANCE_ID'] = str(self.instance_id)
util.subp([filepath], env=env)
except util.ProcessExecutionError:
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 2931830c..c2d78a78 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -233,13 +233,13 @@ class Init(object):
# Write what the datasource was and is..
ds = "%s: %s" % (util.obj_name(self.datasource), self.datasource)
- previous_ds = ''
+ previous_ds = None
ds_fn = os.path.join(idir, 'datasource')
try:
previous_ds = util.load_file(ds_fn).strip()
except Exception:
pass
- if not previous_ds:
+ if previous_ds is None:
# TODO: ?? is this right
previous_ds = ds
util.write_file(ds_fn, "%s\n" % ds)
@@ -248,14 +248,14 @@ class Init(object):
# What the instance id was and is...
iid = self.datasource.get_instance_id()
- previous_iid = ''
+ previous_iid = None
p_iid_fn = os.path.join(dp, 'previous-instance-id')
c_iid_fn = os.path.join(dp, 'instance-id')
try:
previous_iid = util.load_file(p_iid_fn).strip()
except Exception:
pass
- if not previous_iid:
+ if previous_iid is None:
# TODO: ?? is this right
previous_iid = iid
util.write_file(c_iid_fn, "%s\n" % iid)