summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zions (MSFT) <jasonzio@microsoft.com>2019-04-03 22:23:29 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-04-03 22:23:29 +0000
commit528366820bb48c13957d0c58afc2a46a3ba84bef (patch)
tree25968662bde41e33511312b269d60f70f5c81caa
parent0d8c88393b51db6454491a379dcc2e691551217a (diff)
downloadvyos-cloud-init-528366820bb48c13957d0c58afc2a46a3ba84bef.tar.gz
vyos-cloud-init-528366820bb48c13957d0c58afc2a46a3ba84bef.zip
Azure: Treat _unset network configuration as if it were absent
When the Azure datasource persists all of its metadata to the instance directory, it deliberately sets the self.network_config value to be the sources.UNSET value. The goal is to ensure that each time the system boots, fresh network configuration data is fetched from the cloud platform so that any control plane changes will take effect. When a VM is first created, there's no pickled instance to restore, so self._network_config is None, resulting in self.network_config() properly building a new config. Azure suffered from LP: #1801364 which prevented ds from being stored in obj.pkl in the instance directory, so subsequent reboots always regenerated their network configuration. Commit 0dc3a77f41f4544e4cb5a41637af7693410d4cdf introduced a new bug in which self.network_config() assumed the self._network_config value was either None or trustable; when the config was unpickled, that value was _unset, thus breaking the assumption. LP: #1823084
-rwxr-xr-xcloudinit/sources/DataSourceAzure.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index d4230b3c..76b16616 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -688,7 +688,7 @@ class DataSourceAzure(sources.DataSource):
2. Generate a fallback network config that does not include any of
the blacklisted devices.
"""
- if not self._network_config:
+ if not self._network_config or self._network_config == sources.UNSET:
if self.ds_cfg.get('apply_network_config'):
nc_src = self._metadata_imds
else: