From 670a68a5b8f3ab389b5b12254678e160962fa8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 15 Nov 2017 16:15:58 +0100 Subject: [PATCH] gather: JSON source returns nothing without configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lubomír Sedlář --- pungi/phases/gather/sources/source_json.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pungi/phases/gather/sources/source_json.py b/pungi/phases/gather/sources/source_json.py index 404078c2..073935d8 100644 --- a/pungi/phases/gather/sources/source_json.py +++ b/pungi/phases/gather/sources/source_json.py @@ -40,9 +40,11 @@ class GatherSourceJson(pungi.phases.gather.source.GatherSourceBase): enabled = True def __call__(self, arch, variant): - json_path = self.compose.conf["gather_source_mapping"] - data = open(json_path, "r").read() - mapping = json.loads(data) + json_path = self.compose.conf.get("gather_source_mapping") + if not json_path: + return set(), set() + with open(json_path, "r") as f: + mapping = json.load(f) packages = set() if variant is None: