1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 17:55:10 +03:00

fix a confusing error message when extra vars aren't valid JSON/YAML

see: https://github.com/ansible/awx/issues/8359
This commit is contained in:
Ryan Petrello 2020-10-12 12:56:13 -04:00
parent e6c124962b
commit 0cdcbdfea6
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -178,6 +178,9 @@ class ResourceOptionsParser(object):
except Exception: except Exception:
raise argparse.ArgumentTypeError("{} is not valid JSON or YAML".format(v)) raise argparse.ArgumentTypeError("{} is not valid JSON or YAML".format(v))
if not isinstance(parsed, dict):
raise argparse.ArgumentTypeError("{} is not valid JSON or YAML".format(v))
for k, v in parsed.items(): for k, v in parsed.items():
# add support for file reading at top-level JSON keys # add support for file reading at top-level JSON keys
# (to make things like SSH key data easier to work with) # (to make things like SSH key data easier to work with)