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 <qwan@redhat.com>
This commit is contained in:
Qixiang Wan 2017-02-16 16:51:10 +08:00
parent 8d41a004c3
commit d496eeb090

View File

@ -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