cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #06155
[Merge] ~jasonzio/cloud-init:handleUnsetNetCfg into cloud-init:master
Jason Zions has proposed merging ~jasonzio/cloud-init:handleUnsetNetCfg into cloud-init:master.
Commit message:
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. A
recently-fixed bug prevented DataSourceAzure from being stored in
the instance directory, so subsequent reboots always regenerated
their network configuration. With the fixing of that bug, a new
bug was uncovered 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.
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~jasonzio/cloud-init/+git/cloud-init/+merge/365377
--
Your team cloud-init commiters is requested to review the proposed merge of ~jasonzio/cloud-init:handleUnsetNetCfg into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index b4e3f06..1873bc1 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -668,7 +668,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:
Follow ups