summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-12-12 11:50:55 -0500
committerScott Moser <smoser@ubuntu.com>2013-12-12 11:50:55 -0500
commitfd5231ae771cd3b87c26ac2b0839fb672bf0acee (patch)
treed0346bb3d2cadaa48edbd0663cdbd8127202bd2d
parent5414797f1b9286ddbe82c8637dfff74cf352b967 (diff)
downloadvyos-cloud-init-fd5231ae771cd3b87c26ac2b0839fb672bf0acee.tar.gz
vyos-cloud-init-fd5231ae771cd3b87c26ac2b0839fb672bf0acee.zip
be verbose explicitly if run from cmdline.
Let the command line (or module args) that set outfile explicitly override a config'd value of 'verbose'. Ie, if /etc/cloud/cloud.cfg.d/my.cfg had: debug: verbose: False but the user ran: cloud-init single --frequency=always --name=debug output.txt Then they probably wanted to have the debug in output.txt even though verbose was configured to False.
-rw-r--r--cloudinit/config/cc_debug.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/config/cc_debug.py b/cloudinit/config/cc_debug.py
index 55fdf2dd..cfd31fa1 100644
--- a/cloudinit/config/cc_debug.py
+++ b/cloudinit/config/cc_debug.py
@@ -33,15 +33,17 @@ def _make_header(text):
def handle(name, cfg, cloud, log, args):
verbose = util.get_cfg_by_path(cfg, ('debug', 'verbose'), default=True)
- if not verbose:
- log.debug(("Skipping module named %s,"
- " verbose printing disabled"), name)
- return
- out_file = None
if args:
+ # if args are provided (from cmdline) then explicitly set verbose
out_file = args[0]
+ verbose = True
else:
out_file = util.get_cfg_by_path(cfg, ('debug', 'output'))
+
+ if not verbose:
+ log.debug(("Skipping module named %s,"
+ " verbose printing disabled"), name)
+ return
# Clean out some keys that we just don't care about showing...
dump_cfg = copy.deepcopy(cfg)
for k in ['log_cfgs']: