From 02fe9d1f85d1194e631c4992495086ce7733f6e1 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 10 Jul 2012 17:48:25 -0400 Subject: re-setup logging to address cloud-config changes input via user-data If the user has input logging information in user-data cloud-config we want to set up the logging to accept that after the data source has been read. --- bin/cloud-init | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/cloud-init b/bin/cloud-init index 9dd7296e..fafd176d 100755 --- a/bin/cloud-init +++ b/bin/cloud-init @@ -156,8 +156,8 @@ def main_init(name, args): # 6. Connect to the current instance location + update the cache # 7. Consume the userdata (handlers get activated here) # 8. Construct the modules object - # 9. Adjust any subsequent logging/output redirections using - # the modules objects configuration + # 9. Adjust any subsequent logging/output redirections using the modules + # objects config as it may be different from init object # 10. Run the modules for the 'init' stage # 11. Done! w_msg = welcome_format(name) @@ -268,9 +268,10 @@ def main_init(name, args): except Exception: util.logexc(LOG, "Consuming user data failed!") return 1 - # Stage 8 - TODO - do we really need to re-extract our configs? + + # Stage 8 - re-read and apply relevant cloud-config to include user-data mods = stages.Modules(init, extract_fns(args)) - # Stage 9 - TODO is this really needed?? + # Stage 9 try: outfmt_orig = outfmt errfmt_orig = errfmt @@ -280,6 +281,8 @@ def main_init(name, args): (outfmt, errfmt) = util.fixup_output(mods.cfg, name) except: util.logexc(LOG, "Failed to re-adjust output redirection!") + logging.setupLogging(mods.cfg) + # Stage 10 return run_module_section(mods, name, name) -- cgit v1.2.3