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.
This commit is contained in:
Steve Langasek 2024-04-02 00:17:26 -07:00
parent 6ebffe3f4a
commit 3df40f6392

View File

@ -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: