cloud-init-cfg: log warning with traceback on failure of a config module
Previously, all you would get was a warning to the console on config module failure. This changes to get a stack trace of the failure to the console, which is much easier for debugging.
This commit is contained in:
@@ -22,6 +22,7 @@ import cloudinit
|
||||
import cloudinit.CloudConfig
|
||||
import logging
|
||||
import os
|
||||
import traceback
|
||||
|
||||
def Usage(out = sys.stdout):
|
||||
out.write("Usage: %s name\n" % sys.argv[0])
|
||||
@@ -95,6 +96,7 @@ def main():
|
||||
(name, freq, run_args ))
|
||||
cc.handle(name, run_args, freq=freq)
|
||||
except:
|
||||
log.warn(traceback.format_exc())
|
||||
err("config handling of %s, %s, %s failed\n" %
|
||||
(name,freq,run_args), log)
|
||||
failures.append(name)
|
||||
|
||||
@@ -56,6 +56,5 @@ class CloudConfig():
|
||||
self.cloud.sem_and_run("config-" + name, freq, handler,
|
||||
[ name, self.cfg, self.cloud, cloudinit.log, args ])
|
||||
except:
|
||||
cloudinit.log.debug(traceback.format_exc())
|
||||
raise
|
||||
|
||||
|
||||
Reference in New Issue
Block a user