summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorLouis Bouchard <bouchard.louis@gmail.com>2020-01-29 16:55:09 +0100
committerGitHub <noreply@github.com>2020-01-29 10:55:09 -0500
commit9e3ac98097ed1c7f49ec8975a40aec7229231aae (patch)
tree5311ad18aca51d5413b6d75d3179798ab0f4f3fb /cloudinit/sources
parent88b09643787c55b700cfadc25bbe0ddbfe0368e6 (diff)
downloadvyos-cloud-init-9e3ac98097ed1c7f49ec8975a40aec7229231aae.tar.gz
vyos-cloud-init-9e3ac98097ed1c7f49ec8975a40aec7229231aae.zip
Scaleway: Fix DatasourceScaleway to avoid backtrace (#128)
Make sure network_config is created when self._network_config is unset. Co-authored-by: Scott Moser <smoser@brickies.net>
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceScaleway.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceScaleway.py b/cloudinit/sources/DataSourceScaleway.py
index b573b382..83c2bf65 100644
--- a/cloudinit/sources/DataSourceScaleway.py
+++ b/cloudinit/sources/DataSourceScaleway.py
@@ -188,7 +188,7 @@ class DataSourceScaleway(sources.DataSource):
self.retries = int(self.ds_cfg.get('retries', DEF_MD_RETRIES))
self.timeout = int(self.ds_cfg.get('timeout', DEF_MD_TIMEOUT))
self._fallback_interface = None
- self._network_config = None
+ self._network_config = sources.UNSET
def _crawl_metadata(self):
resp = url_helper.readurl(self.metadata_address,
@@ -227,7 +227,12 @@ class DataSourceScaleway(sources.DataSource):
Configure networking according to data received from the
metadata API.
"""
- if self._network_config:
+ if self._network_config is None:
+ LOG.warning('Found None as cached _network_config. '
+ 'Resetting to %s', sources.UNSET)
+ self._network_config = sources.UNSET
+
+ if self._network_config != sources.UNSET:
return self._network_config
if self._fallback_interface is None: