From 0da32ffff8511b5309d7d9e790136aa52d606e72 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 14 Jun 2024 12:51:20 -0600 Subject: [PATCH 1/2] suite.Run.schedule_jobs: Unmask error in dry-run For whatever reason we were suppressing an error related to unavailable packages. Signed-off-by: Zack Cerza --- teuthology/suite/run.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index a37887811..8fa45b5b4 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -512,13 +512,10 @@ def schedule_jobs(self, jobs_missing_packages, jobs_to_schedule, name): log_prefix = '' if job in jobs_missing_packages: log_prefix = "Missing Packages: " - if ( - not self.args.dry_run and - not config.suite_allow_missing_packages - ): + if not config.suite_allow_missing_packages: util.schedule_fail( - "At least one job needs packages that don't exist for " - "hash {sha1}.".format(sha1=self.base_config.sha1), + "At least one job needs packages that don't exist " + f"for hash {self.base_config.sha1}.", name, dry_run=self.args.dry_run, ) From 24b6915252dec65a135dfe4b6d8d4703b0a53a5e Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 14 Jun 2024 13:06:43 -0600 Subject: [PATCH 2/2] suite.util.find_git_parents: Fix KeyError And clean up the code a bit Signed-off-by: Zack Cerza --- teuthology/suite/util.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/teuthology/suite/util.py b/teuthology/suite/util.py index e1d311593..5300c6561 100644 --- a/teuthology/suite/util.py +++ b/teuthology/suite/util.py @@ -348,15 +348,19 @@ def find_git_parents(project: str, sha1: str, count=1): return [] def get_sha1s(project, committish, count): - url = '/'.join((base_url, '%s.git' % project, - 'history/?committish=%s&count=%d' % (committish, count))) + url = '/'.join(( + base_url, + f"{project}.git", + f"history/?committish={committish}&count={count}" + )) resp = requests.get(url) resp.raise_for_status() sha1s = resp.json()['sha1s'] if len(sha1s) != count: - log.debug('got response: %s', resp.json()) - log.error('can''t find %d parents of %s in %s: %s', - int(count), sha1, project, resp.json()['error']) + resp_json = resp.json() + err_msg = resp_json.get("error") or resp_json.get("err") + log.debug(f"Got response: {resp_json}") + log.error(f"Can't find {count} parents of {sha1} in {project}: {err_msg}") return sha1s # index 0 will be the commit whose parents we want to find.