Work around ODCS creating COMPOSE_ID later

When ODCS starts a compose, it will provide base composeinfo file, but
it doesn't create COMPOSE_ID. This leads to a crash when updating CTS,
since the compose id can't be read from the file. We can instead use the
value we already have in memory.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2021-09-14 11:44:45 +02:00 committed by lsedlar
parent 0530cf2712
commit ac061b2ea8
2 changed files with 2 additions and 4 deletions

View File

@ -150,11 +150,9 @@ def write_compose_info(compose_dir, ci):
ci.dump(os.path.join(work_dir, "composeinfo-base.json")) ci.dump(os.path.join(work_dir, "composeinfo-base.json"))
def update_compose_url(compose_dir, conf): def update_compose_url(compose_id, compose_dir, conf):
import requests import requests
with open(os.path.join(compose_dir, "COMPOSE_ID"), "r") as f:
compose_id = f.read()
authentication = get_authentication(conf) authentication = get_authentication(conf)
cts_url = conf.get("cts_url", None) cts_url = conf.get("cts_url", None)
if cts_url: if cts_url:

View File

@ -329,7 +329,7 @@ def main():
notifier=notifier, notifier=notifier,
) )
rv = Compose.update_compose_url(compose_dir, conf) rv = Compose.update_compose_url(compose.compose_id, compose_dir, conf)
if rv and not rv.ok: if rv and not rv.ok:
logger.error("CTS compose_url update failed with the error: %s" % rv.text) logger.error("CTS compose_url update failed with the error: %s" % rv.text)