From d496eeb090825ec0bdb0982d9d9beb8763bf5005 Mon Sep 17 00:00:00 2001 From: Qixiang Wan Date: Thu, 16 Feb 2017 16:51:10 +0800 Subject: [PATCH] handle opening empty images.json while re-running pungi-koji in debug mode If there is an empty images.json file exists, re-running pungi-koji in debug-mode will fail with exception. We can just ignore the exception in such cases, pungi-koji will create a correct images.json later. Signed-off-by: Qixiang Wan --- pungi/compose.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pungi/compose.py b/pungi/compose.py index 8e73855c..981ae888 100644 --- a/pungi/compose.py +++ b/pungi/compose.py @@ -134,8 +134,12 @@ class Compose(kobo.log.LoggingBase): self.im.load(self.paths.compose.metadata("images.json")) except RuntimeError: pass + # images.json doesn't exists except IOError: pass + # images.json is not a valid json file, for example, it's an empty file + except ValueError: + pass self.im.compose.id = self.compose_id self.im.compose.type = self.compose_type self.im.compose.date = self.compose_date