Smooth out upgrades to playbook semaphores

If running a scheduler on code prior to change
I90f5e0f570ef6c4b0986b0143318a78ddc27bbde when upgrading an executor
to a version which includes it, playbooks will lack a semaphores
list. Assume it's empty in that case, in order to avoid causing
transient build failures during a rolling upgrade of Zuul services.

Change-Id: I17d08f40e9feba62923c6f12a1d4f8b2a05f9cae
This commit is contained in:
Jeremy Stanley
2022-11-12 15:40:51 +00:00
parent 57451d04b9
commit 35e5c4ce39

View File

@@ -2041,7 +2041,9 @@ class AnsibleJob(object):
jobdir_playbook.project_canonical_name = project.canonical_name
jobdir_playbook.canonical_name_and_path = os.path.join(
project.canonical_name, playbook['path'])
jobdir_playbook.semaphores = playbook['semaphores']
# The playbook may lack semaphores if mid-upgrade and a build is run on
# behalf of a scheduler too old to add them.
jobdir_playbook.semaphores = playbook.get('semaphores', [])
path = None
if not jobdir_playbook.trusted: