]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: add error condition to exec functions
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 27 Feb 2024 14:48:25 +0000 (09:48 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 21 Mar 2024 22:31:16 +0000 (18:31 -0400)
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>
qa/tasks/cephadm.py

index fdc9fdcd7392f8e66c903bc40df1fdaf7a2fada9..66d51aff2f5486cf894c909b3c492eec46ddb98c 100644 (file)
@@ -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