From 605c9ca435d7386e379b45a4e9dce6f599d48a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 15 Nov 2018 15:05:17 +0100 Subject: [PATCH] Allow reading configuration from JSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JIRA: COMPOSE-3064 Signed-off-by: Lubomír Sedlář --- bin/pungi-koji | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/pungi-koji b/bin/pungi-koji index 42dcb424..fcd1477e 100755 --- a/bin/pungi-koji +++ b/bin/pungi-koji @@ -218,7 +218,13 @@ def main(): kobo.log.add_stderr_logger(logger) conf = kobo.conf.PyConfigParser() - conf.load_from_file(opts.config) + if opts.config.endswith(".json"): + with open(opts.config) as f: + conf.load_from_dict(json.load(f)) + conf.opened_files = [opts.config] + conf._open_file = opts.config + else: + conf.load_from_file(opts.config) compose_type = opts.compose_type or conf.get('compose_type', 'production') if compose_type == "production" and not opts.label and not opts.no_label: