summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/sources/DataSourceAzure.py2
-rw-r--r--cloudinit/sources/DataSourceNoCloud.py2
-rw-r--r--cloudinit/sources/DataSourceOpenStack.py2
-rw-r--r--cloudinit/sources/__init__.py2
-rw-r--r--cloudinit/stages.py15
5 files changed, 12 insertions, 11 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 832b3063..698f4cac 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -254,7 +254,7 @@ class DataSourceAzureNet(sources.DataSource):
def get_config_obj(self):
return self.cfg
- def check_instance_id(self):
+ def check_instance_id(self, sys_cfg):
# quickly (local check only) if self.instance_id is still valid
return sources.instance_id_matches_system_uuid(self.get_instance_id())
diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py
index afd08935..802d515b 100644
--- a/cloudinit/sources/DataSourceNoCloud.py
+++ b/cloudinit/sources/DataSourceNoCloud.py
@@ -209,7 +209,7 @@ class DataSourceNoCloud(sources.DataSource):
mydata['meta-data']['dsmode'])
return False
- def check_instance_id(self):
+ def check_instance_id(self, sys_cfg):
# quickly (local check only) if self.instance_id is still valid
# we check kernel command line or files.
current = self.get_instance_id()
diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py
index 79bb9d63..f7f4590b 100644
--- a/cloudinit/sources/DataSourceOpenStack.py
+++ b/cloudinit/sources/DataSourceOpenStack.py
@@ -150,7 +150,7 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource):
return True
- def check_instance_id(self):
+ def check_instance_id(self, sys_cfg):
# quickly (local check only) if self.instance_id is still valid
return sources.instance_id_matches_system_uuid(self.get_instance_id())
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index c63464b2..82cd3553 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -217,7 +217,7 @@ class DataSource(object):
def get_package_mirror_info(self):
return self.distro.get_package_mirror_info(data_source=self)
- def check_instance_id(self):
+ def check_instance_id(self, sys_cfg):
# quickly (local check only) if self.instance_id is still
return False
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 73090025..5d6b0447 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -223,7 +223,8 @@ class Init(object):
if ds and existing == "trust":
myrep.description = "restored from cache: %s" % ds
elif ds and existing == "check":
- if hasattr(ds, 'check_instance_id') and ds.check_instance_id():
+ if (hasattr(ds, 'check_instance_id') and
+ ds.check_instance_id(self.cfg)):
myrep.description = "restored from checked cache: %s" % ds
else:
myrep.description = "cache invalid in datasource: %s" % ds
@@ -578,18 +579,18 @@ class Init(object):
for loc, ncfg in (cmdline_cfg, dscfg, sys_cfg):
if net.is_disabled_cfg(ncfg):
LOG.debug("network config disabled by %s", loc)
- return None
+ return (None, loc)
if ncfg:
- return ncfg
- return net.generate_fallback_config()
+ return (ncfg, loc)
+ return (net.generate_fallback_config(), "fallback")
def apply_network_config(self):
- netcfg = self._find_networking_config()
+ netcfg, src = self._find_networking_config()
if netcfg is None:
- LOG.info("network config is disabled")
+ LOG.info("network config is disabled by %s", src)
return
- LOG.info("Applying configuration: %s", netcfg)
+ LOG.info("Applying network configuration from %s: %s", src, netcfg)
return self.distro.apply_network_config(netcfg)