summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-08-24 16:53:41 -0400
committerScott Moser <smoser@ubuntu.com>2012-08-24 16:53:41 -0400
commit0a84d4e669913fe221a61a34641252d6b172299f (patch)
treeac6fbb5f5bd8f7f31475c3707bf5b104a701e642
parentcd47f4a6ae1249c3b516259edaa79fcc80a5990b (diff)
downloadvyos-cloud-init-0a84d4e669913fe221a61a34641252d6b172299f.tar.gz
vyos-cloud-init-0a84d4e669913fe221a61a34641252d6b172299f.zip
use instance-id, not previous-instance-id.
at the point where we are getting the previous instance id, there cloud-init hasn't performed the move yet. Therefore, the "previous" is the one that /var/lib/cloud/data/ says is the current.
-rw-r--r--cloudinit/sources/DataSourceConfigDrive.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index 585dbb58..558e773c 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -373,8 +373,10 @@ def get_ds_mode(cfgdrv_ver, ds_cfg=None, user=None):
def get_previous_iid(paths):
- fname = os.path.join(paths.get_cpath('data'),
- 'previous-instance-id')
+ # interestingly, for this purpose the "previous" instance-id is the current
+ # instance-id. cloud-init hasn't moved them over yet as this datasource
+ # hasn't declared itself found.
+ fname = os.path.join(paths.get_cpath('data'), 'instance-id')
try:
with open(fname) as fp:
return fp.read()