]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Set ctx.cluster even when a job has no roles 956/head
authorZack Cerza <zack@redhat.com>
Tue, 20 Sep 2016 16:03:46 +0000 (10:03 -0600)
committerZack Cerza <zack@redhat.com>
Wed, 21 Sep 2016 15:58:04 +0000 (09:58 -0600)
This is to allow for teuthology to run self-tests that don't use
resources.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/run.py
teuthology/task/internal.py

index e1f79a1270969df7fc79214639ed02bc360ec32b..4f4646fd10fb2dfa190b15df04dfee357c4528bd 100644 (file)
@@ -184,13 +184,15 @@ def get_initial_tasks(lock, config, machine_type):
         init_tasks.append({'internal.lock_machines': (
             len(config['roles']), machine_type)})
 
-
     init_tasks.append({'internal.save_config': None})
 
+    if 'roles' in config:
+        init_tasks.append({'internal.check_lock': None})
+
+    init_tasks.append({'internal.add_remotes': None})
+
     if 'roles' in config:
         init_tasks.extend([
-            {'internal.check_lock': None},
-            {'internal.add_remotes': None},
             {'console_log': None},
             {'internal.connect': None},
             {'internal.push_inventory': None},
index 742f6fd078f25af94dda061ebaba80f476d0f8bb..367796127834e5e1550635d5fa8fdd6fc7a0aae6 100644 (file)
@@ -308,6 +308,10 @@ def add_remotes(ctx, config):
     """
     Create a ctx.cluster object populated with remotes mapped to roles
     """
+    ctx.cluster = cluster.Cluster()
+    # Allow jobs to run without using nodes, for self-testing
+    if 'roles' not in ctx.config and 'targets' not in ctx.config:
+        return
     remotes = []
     machs = []
     for name in ctx.config['targets'].iterkeys():
@@ -321,7 +325,6 @@ def add_remotes(ctx, config):
             pass
         rem = remote.Remote(name=t, host_key=key, keep_alive=True)
         remotes.append(rem)
-    ctx.cluster = cluster.Cluster()
     if 'roles' in ctx.config:
         for rem, roles in zip(remotes, ctx.config['roles']):
             assert all(isinstance(role, str) for role in roles), \