check options exist before forcing assignment
This commit is contained in:
parent
e1416138f9
commit
0209685f8d
1 changed files with 19 additions and 17 deletions
|
@ -121,6 +121,7 @@ def merge_hash(a, b):
|
||||||
|
|
||||||
def load_extra_vars(loader, options):
|
def load_extra_vars(loader, options):
|
||||||
extra_vars = {}
|
extra_vars = {}
|
||||||
|
if hasattr(options, 'extra_vars'):
|
||||||
for extra_vars_opt in options.extra_vars:
|
for extra_vars_opt in options.extra_vars:
|
||||||
data = None
|
data = None
|
||||||
extra_vars_opt = to_text(extra_vars_opt, errors='surrogate_or_strict')
|
extra_vars_opt = to_text(extra_vars_opt, errors='surrogate_or_strict')
|
||||||
|
@ -146,6 +147,7 @@ def load_options_vars(options, version):
|
||||||
options_vars = {}
|
options_vars = {}
|
||||||
# For now only return check mode, but we can easily return more
|
# For now only return check mode, but we can easily return more
|
||||||
# options if we need variables for them
|
# options if we need variables for them
|
||||||
|
if hasattr(options, 'check'):
|
||||||
options_vars['ansible_check_mode'] = options.check
|
options_vars['ansible_check_mode'] = options.check
|
||||||
options_vars['ansible_version'] = version
|
options_vars['ansible_version'] = version
|
||||||
return options_vars
|
return options_vars
|
||||||
|
|
Loading…
Reference in a new issue