summaryrefslogtreecommitdiff
path: root/bin/cloud-init
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cloud-init')
-rwxr-xr-xbin/cloud-init22
1 files changed, 13 insertions, 9 deletions
diff --git a/bin/cloud-init b/bin/cloud-init
index 5857af32..ffd1f2cc 100755
--- a/bin/cloud-init
+++ b/bin/cloud-init
@@ -236,6 +236,7 @@ def main_init(name, args):
else:
LOG.debug("Execution continuing, no previous run detected that"
" would allow us to stop early.")
+
else:
existing = "check"
if util.get_cfg_option_bool(init.cfg, 'manual_cache_clean', False):
@@ -259,23 +260,26 @@ def main_init(name, args):
util.logexc(LOG, ("No instance datasource found!"
" Likely bad things to come!"))
if not args.force:
- init.apply_network_config()
+ init.apply_network_config(bring_up=not args.local)
if args.local:
return (None, [])
else:
return (None, ["No instance datasource found."])
- if args.local:
- if 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()
- else:
- LOG.debug("skipping networking config from restored datasource.")
-
# Stage 6
iid = init.instancify()
LOG.debug("%s will now be targeting instance id: %s", name, iid)
+
+ if init.is_new_instance():
+ # on new instance, apply network config.
+ # in network mode 'bring_up' must be passed in as the OS
+ # has already brought up networking.
+ init.apply_network_config(bring_up=not args.local)
+
+ if args.local and init.datasource.dsmode != sources.DSMODE_LOCAL:
+ return (init.datasource, [])
+
+ # update fully realizes user-data (pulling in #include if necessary)
init.update()
# Stage 7
try: