Commit 79b59658 authored by Scott Moser's avatar Scott Moser

only apply networking once per instance

This attempts to only apply the networking once per instance
by doing so only if the datasource was restored from disk.

This will work by default for datasources with a functioning
check_instance_id or if the user has set manual_cache_clean to true.
parent f7d6eaef
......@@ -265,7 +265,9 @@ def main_init(name, args):
else:
return (None, ["No instance datasource found."])
if args.local:
if args.local and not init.ds_restored:
# if local mode and the datasource was not restored from cache
# (this is not first boot) then apply networking.
init.apply_network_config()
# Stage 6
......
......@@ -66,6 +66,7 @@ class Init(object):
self._distro = None
# Changed only when a fetch occurs
self.datasource = NULL_DATA_SOURCE
self.ds_restored = False
if reporter is None:
reporter = events.ReportEventStack(
......@@ -80,6 +81,7 @@ class Init(object):
self._distro = None
if reset_ds:
self.datasource = NULL_DATA_SOURCE
self.ds_restored = False
@property
def distro(self):
......@@ -231,6 +233,8 @@ class Init(object):
ds = None
else:
myrep.description = "no cache found"
self.ds_restored = bool(ds)
LOG.debug(myrep.description)
if not ds:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment