summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:31:48 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:31:48 -0700
commit1154876da44e1fd4516807637c317ce9828fe08b (patch)
treeaaac3f5ed762a70c6f10859ea8aef66870e574ed
parentfc026d6e7dd51ea8c04e081c821e086f89bf6291 (diff)
downloadvyos-cloud-init-1154876da44e1fd4516807637c317ce9828fe08b.tar.gz
vyos-cloud-init-1154876da44e1fd4516807637c317ce9828fe08b.zip
Fix logic issue with reading previous file for previous instance id, when the current file should be looked at instead
-rw-r--r--cloudinit/stages.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index b0eef928..ddac2ac2 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -249,17 +249,17 @@ class Init(object):
# What the instance id was and is...
iid = self.datasource.get_instance_id()
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()
+ previous_iid = util.load_file(c_iid_fn).strip()
except Exception:
pass
if not previous_iid:
# TODO: ?? is this right
previous_iid = iid
util.write_file(c_iid_fn, "%s\n" % iid)
- util.write_file(p_iid_fn, "%s\n" % previous_iid)
+ util.write_file(os.path.join(dp, 'previous-instance-id'),
+ "%s\n" % previous_iid)
return iid
def fetch(self):