Add more info to merge mode selection errors

It can be confusing to know what merge modes are considered valid for a
project when Zuul tells you: "Merge mode foo is not supported by project
bar." Update this error message to include the list of merge modes that
Zuul considers to be valid for the project to reduce confusion.

Change-Id: If0d5cf1b06a93f3da507fba43077a5a9e327ca5e
This commit is contained in:
Clark Boylan 2023-05-31 09:14:16 -07:00
parent b01446e8a8
commit 1d8ce7737e
1 changed files with 4 additions and 1 deletions

View File

@ -2697,8 +2697,11 @@ class TenantParser(object):
if project_metadata.merge_mode not in tpc.merge_modes:
mode = model.get_merge_mode_name(
project_metadata.merge_mode)
allowed_modes = list(map(model.get_merge_mode_name,
tpc.merge_modes))
raise Exception(f'Merge mode {mode} not supported '
f'by project {project_name}')
f'by project {project_name}. '
f'Supported modes: {allowed_modes}.')
def _parseLayout(self, tenant, data, loading_errors, layout_uuid=None):
# Don't call this method from dynamic reconfiguration because