init_tasks.append({'internal.lock_machines': (
len(config['roles']), machine_type)})
-
- init_tasks.append({'internal.save_config': None})
+ init_tasks.extend([
+ {'internal.save_config': None},
+ {'internal.check_lock': None},
+ {'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},
"""
Check lock status of remote machines.
"""
- if not teuth_config.lock_server or ctx.config.get('check-locks') is False:
+ if (
+ not teuth_config.lock_server or
+ ctx.config.get('check-locks') is False or
+ 'roles' not in ctx.config
+ ):
log.info('Lock checking disabled.')
return
log.info('Checking locks...')
"""
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:
+ return
remotes = []
machs = []
for name in ctx.config['targets'].iterkeys():
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), \