diff options
author | Matt Martz <matt@sivel.net> | 2018-04-03 11:37:16 -0500 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2018-04-05 16:06:01 -0400 |
commit | b794fa4fe74c9063346dfed32727298aeecb2e8d (patch) | |
tree | f1d59eb045e60ce4346fbffc387c243b5e858d49 | |
parent | 0d31d1cd24dbadc228acea146d26f2aa5137a3c7 (diff) | |
download | ansible-b794fa4fe74c9063346dfed32727298aeecb2e8d.tar.gz |
Expose verbosity as a var, dedupe attr list. Fixes #36170
-rw-r--r-- | lib/ansible/utils/vars.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/ansible/utils/vars.py b/lib/ansible/utils/vars.py index 7270e79599..9a3f960587 100644 --- a/lib/ansible/utils/vars.py +++ b/lib/ansible/utils/vars.py @@ -146,16 +146,19 @@ def load_extra_vars(loader, options): def load_options_vars(options, version): options_vars = {'ansible_version': version} - aliases = {'check': 'check_mode', - 'diff': 'diff_mode', - 'inventory': 'inventory_sources', - 'subset': 'limit', - 'tags': 'run_tags'} - - for attr in ('check', 'diff', 'forks', 'inventory', 'skip_tags', 'subset', 'tags'): + attrs = {'check': 'check_mode', + 'diff': 'diff_mode', + 'forks': 'forks', + 'inventory': 'inventory_sources', + 'skip_tags': 'skip_tags', + 'subset': 'limit', + 'tags': 'run_tags', + 'verbosity': 'verbosity'} + + for attr, alias in attrs.items(): opt = getattr(options, attr, None) if opt is not None: - options_vars['ansible_%s' % aliases.get(attr, attr)] = opt + options_vars['ansible_%s' % alias] = opt return options_vars |