From 3df40f63929e91a967c95b16d8d21e1a1aefa088 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Tue, 2 Apr 2024 00:17:26 -0700 Subject: [PATCH] Handle exceptions on retry The "can be retried" value from launchpad may have been cached. Avoid an exception when we race someone else retrying a build. --- ubuntu-build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ubuntu-build b/ubuntu-build index 4babab4..5991d8d 100755 --- a/ubuntu-build +++ b/ubuntu-build @@ -377,8 +377,12 @@ def main(): if args.retry and build.can_be_retried: Logger.info("Retrying build of %s on %s...", build.source_package_name, build.arch_tag) - build.retry() - retry_count += 1 + try: + build.retry() + retry_count += 1 + except lazr.restfulclient.errors.BadRequest: + Logger.info("Failed to retry build of %s on %s", + build.source_package_name, build.arch_tag) if args.priority and can_rescore: if build.can_be_rescored: