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.
This commit is contained in:
parent
fe069d3a72
commit
c3fb65b931
@ -33,15 +33,17 @@ def _make_header(text):
|
|||||||
|
|
||||||
def handle(name, cfg, cloud, log, args):
|
def handle(name, cfg, cloud, log, args):
|
||||||
verbose = util.get_cfg_by_path(cfg, ('debug', 'verbose'), default=True)
|
verbose = util.get_cfg_by_path(cfg, ('debug', 'verbose'), default=True)
|
||||||
|
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:
|
if not verbose:
|
||||||
log.debug(("Skipping module named %s,"
|
log.debug(("Skipping module named %s,"
|
||||||
" verbose printing disabled"), name)
|
" verbose printing disabled"), name)
|
||||||
return
|
return
|
||||||
out_file = None
|
|
||||||
if args:
|
|
||||||
out_file = args[0]
|
|
||||||
else:
|
|
||||||
out_file = util.get_cfg_by_path(cfg, ('debug', 'output'))
|
|
||||||
# Clean out some keys that we just don't care about showing...
|
# Clean out some keys that we just don't care about showing...
|
||||||
dump_cfg = copy.deepcopy(cfg)
|
dump_cfg = copy.deepcopy(cfg)
|
||||||
for k in ['log_cfgs']:
|
for k in ['log_cfgs']:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user