Adds 'ansible_check_mode' boolean magic variable

* Makes it possible to pass any options variable to VariableManager
  by changing `load_options_vars(options)` in `lib/ansible/utils/vars.py`
This commit is contained in:
Strahinja Kustudić 2016-01-20 19:47:09 +01:00
commit eed6cf5dad
7 changed files with 54 additions and 2 deletions

View file

@ -111,6 +111,13 @@ def load_extra_vars(loader, options):
extra_vars = combine_vars(extra_vars, data)
return extra_vars
def load_options_vars(options):
options_vars = {}
# For now only return check mode, but we can easily return more
# options if we need variables for them
options_vars['ansible_check_mode'] = options.check
return options_vars
def isidentifier(ident):
"""
Determines, if string is valid Python identifier using the ast module.