From 75410c3d76f0e39d32f8c05fe094c14b0023dfbd Mon Sep 17 00:00:00 2001 From: Guilherme Gallo Date: Wed, 23 Mar 2022 19:26:47 -0300 Subject: [PATCH] ci/lava: Fix LAVA job validation When jobs.validate returns something, it means that there is a dict filled with the error message, so we were running the job with some validation errors for a quite while Signed-off-by: Guilherme Gallo Part-of: --- .gitlab-ci/lava/lava_job_submitter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci/lava/lava_job_submitter.py b/.gitlab-ci/lava/lava_job_submitter.py index 11ee4650887..ba4c2cef795 100755 --- a/.gitlab-ci/lava/lava_job_submitter.py +++ b/.gitlab-ci/lava/lava_job_submitter.py @@ -33,6 +33,7 @@ import urllib.parse import xmlrpc from datetime import datetime, timedelta from os import getenv +from typing import Optional import lavacli import yaml @@ -226,7 +227,7 @@ class LAVAJob(): def heartbeat(self): self.last_log_time = datetime.now() - def validate(self): + def validate(self) -> Optional[dict]: try: return _call_proxy( self.proxy.scheduler.jobs.validate, self.definition, True @@ -386,7 +387,7 @@ def main(args): if args.validate_only: job = LAVAJob(proxy, job_definition) ret = job.validate() - if not ret: + if ret: fatal_err("Error in LAVA job definition") print("LAVA job definition validated successfully") return