summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceAzure.py
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2014-01-15 17:18:32 -0700
committerBen Howard <ben.howard@canonical.com>2014-01-15 17:18:32 -0700
commit4fe439b9e137e0b59d00e919dc16aea9da35082a (patch)
treee4a43901a4ac5cc5a362d0c21271a18d9af07201 /cloudinit/sources/DataSourceAzure.py
parent08b50a6ea239f480493f202c563d788cabb92380 (diff)
downloadvyos-cloud-init-4fe439b9e137e0b59d00e919dc16aea9da35082a.tar.gz
vyos-cloud-init-4fe439b9e137e0b59d00e919dc16aea9da35082a.zip
Fix for race condition where 'captured' Windows Azure instances identify
as the previous instance (LP: #1269626).
Diffstat (limited to 'cloudinit/sources/DataSourceAzure.py')
-rw-r--r--cloudinit/sources/DataSourceAzure.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 97f151d6..448915d7 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -93,6 +93,12 @@ class DataSourceAzureNet(sources.DataSource):
try:
if cdev.startswith("/dev/"):
ret = util.mount_cb(cdev, load_azure_ds_dir)
+
+ # If we load the OVF from a device, it means that a
+ # new ovf-env.xml has been found. (LP: #1269626)
+ if os.path.exists(ddir):
+ LOG.info("removing old agent directory %s" % ddir)
+ util.del_dir(ddir)
else:
ret = load_azure_ds_dir(cdev)