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.
This commit is contained in:
Scott Moser 2012-07-10 17:48:25 -04:00
parent 214d0ef546
commit c2f8f31d43

View File

@ -156,8 +156,8 @@ def main_init(name, args):
# 6. Connect to the current instance location + update the cache # 6. Connect to the current instance location + update the cache
# 7. Consume the userdata (handlers get activated here) # 7. Consume the userdata (handlers get activated here)
# 8. Construct the modules object # 8. Construct the modules object
# 9. Adjust any subsequent logging/output redirections using # 9. Adjust any subsequent logging/output redirections using the modules
# the modules objects configuration # objects config as it may be different from init object
# 10. Run the modules for the 'init' stage # 10. Run the modules for the 'init' stage
# 11. Done! # 11. Done!
w_msg = welcome_format(name) w_msg = welcome_format(name)
@ -268,9 +268,10 @@ def main_init(name, args):
except Exception: except Exception:
util.logexc(LOG, "Consuming user data failed!") util.logexc(LOG, "Consuming user data failed!")
return 1 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)) mods = stages.Modules(init, extract_fns(args))
# Stage 9 - TODO is this really needed?? # Stage 9
try: try:
outfmt_orig = outfmt outfmt_orig = outfmt
errfmt_orig = errfmt errfmt_orig = errfmt
@ -280,6 +281,8 @@ def main_init(name, args):
(outfmt, errfmt) = util.fixup_output(mods.cfg, name) (outfmt, errfmt) = util.fixup_output(mods.cfg, name)
except: except:
util.logexc(LOG, "Failed to re-adjust output redirection!") util.logexc(LOG, "Failed to re-adjust output redirection!")
logging.setupLogging(mods.cfg)
# Stage 10 # Stage 10
return run_module_section(mods, name, name) return run_module_section(mods, name, name)