catch bad extra vars data earlier

Bad extra early (#22322)

(cherry picked from commit c71b15a696)
This commit is contained in:
Brian Coca 2017-03-07 13:44:36 -05:00 committed by Brian Coca
parent f5dbb555fa
commit bd8f81b13b

View file

@ -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)
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):