From 0a84d4e669913fe221a61a34641252d6b172299f Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 24 Aug 2012 16:53:41 -0400 Subject: 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. --- cloudinit/sources/DataSourceConfigDrive.py | 6 ++++-- 1 file 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() -- cgit v1.2.3