Merge pull request #8370 from ryanpetrello/fix-bad-extra-vars-warning

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

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-10-12 20:17:15 +00:00 committed by GitHub
commit bad064b577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,6 +178,9 @@ class ResourceOptionsParser(object):
except Exception:
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():
# add support for file reading at top-level JSON keys
# (to make things like SSH key data easier to work with)