Skip to content

Commit

Permalink
qa/tasks: add error condition to exec functions
Browse files Browse the repository at this point in the history
Looking at the code that expands `all-roles` and `all-hosts` there's no
proper error checking for when these values appear but there are >1
top-level roles in the task config. If a user does this it'll fail
but in a somewhat unclear manner. Add a new condition that raises a
clear exception in this case hopefully saving someone future debugging
time.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
  • Loading branch information
phlogistonjohn committed Mar 21, 2024
1 parent bf1607a commit 9670490
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qa/tasks/cephadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,10 @@ def _expand_roles(ctx, config):
a = config['all-hosts']
roles = teuthology.all_roles(ctx.cluster)
config = dict((id_, a) for id_ in roles if id_.startswith('host.'))
elif 'all-roles' in config or 'all-hosts' in config:
raise ValueError(
'all-roles/all-hosts may not be combined with any other roles'
)
return config


Expand Down

0 comments on commit 9670490

Please sign in to comment.