catch bad extra vars data earlier
Bad extra early (#22322)
(cherry picked from commit c71b15a696
)
This commit is contained in:
parent
f5dbb555fa
commit
bd8f81b13b
1 changed files with 7 additions and 2 deletions
|
@ -26,7 +26,7 @@ from collections import MutableMapping
|
|||
from ansible.compat.six import iteritems, string_types
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.errors import AnsibleError, AnsibleOptionsError
|
||||
from ansible.parsing.splitter import parse_kv
|
||||
from ansible.utils.unicode import to_unicode, to_str
|
||||
|
||||
|
@ -108,7 +108,12 @@ def load_extra_vars(loader, options):
|
|||
else:
|
||||
# Arguments as Key-value
|
||||
data = parse_kv(extra_vars_opt)
|
||||
extra_vars = combine_vars(extra_vars, data)
|
||||
|
||||
if isinstance(data, MutableMapping):
|
||||
extra_vars = combine_vars(extra_vars, data)
|
||||
else:
|
||||
raise AnsibleOptionsError("Invalid extra vars data supplied. '%s' could not be made into a dictionary" % extra_vars_opt)
|
||||
|
||||
return extra_vars
|
||||
|
||||
def load_options_vars(options):
|
||||
|
|
Loading…
Reference in a new issue