config: Allow validating configuration in JSON

JIRA: COMPOSE-3318
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-03-04 14:36:28 +01:00
parent 357f556d69
commit a206a73db1

View File

@ -79,6 +79,12 @@ def read_variants(compose, config):
def run(config, topdir, has_old, offline):
conf = kobo.conf.PyConfigParser()
if config.endswith(".json"):
with open(config) as f:
conf.load_from_dict(json.load(f))
conf.opened_files = [config]
conf._open_file = config
else:
conf.load_from_file(config)
errors, warnings = pungi.checks.validate(conf, offline=offline)