oscontainer: Handle being run without a cosa build
I'm working on synthesizing an update from an existing oscontainer
and doing that I don't have a cosa build for it handy.
If we don't find a `builds.json`, assume we're not in a cosa
directory and skip adding the metadata.
@@ -199,6 +199,7 @@ def oscontainer_build(containers_storage, tmpdir, src, ref, image_name_and_tag,
if ostree_version is not None:
config += ['-l', 'version=' + ostree_version]
+ if os.path.isfile('builds/builds.json'):
with open('builds/builds.json') as fb:
builds = json.load(fb)['builds']
latest_build = builds[0]['id']
