Read tenant config with care in github_manager

The addition of ACLs to zuul/main.yaml broke the naive parsing done
by the maintain-github-mirror playbook, as it assumed all list items
were tenant definitions. Add a conditional check to allow it to skip
past any which aren't.

Change-Id: I31ab916a17fd116f00e94ea7bfa4d7243c0e1c2c
This commit is contained in:
Jeremy Stanley 2022-02-15 20:24:24 +00:00
parent e14c59a6e1
commit 3c9b1c3bf1
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ def list_repos_in_zuul(project_config, tenant='openstack', org='openstack'):
main_yaml_filename = os.path.join(project_config, 'zuul/main.yaml')
with open(main_yaml_filename, 'r') as main_yaml:
for t in yaml.safe_load(main_yaml):
if t['tenant']['name'] == tenant:
if 'tenant' in t and t['tenant']['name'] == tenant:
for ps, pt in t['tenant']['source']['gerrit'].items():
for elem in pt:
if type(elem) is dict: