From 4fe439b9e137e0b59d00e919dc16aea9da35082a Mon Sep 17 00:00:00 2001 From: Ben Howard Date: Wed, 15 Jan 2014 17:18:32 -0700 Subject: Fix for race condition where 'captured' Windows Azure instances identify as the previous instance (LP: #1269626). --- cloudinit/sources/DataSourceAzure.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- cgit v1.2.3