From c6988a07f4b3a417c29e6bcf892c49f42b7d70d2 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Thu, 17 Nov 2011 11:57:07 -0800 Subject: [PATCH] Save config after locking nodes, so targets are included. --- teuthology/run.py | 4 +--- teuthology/task/internal.py | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/teuthology/run.py b/teuthology/run.py index 3455daeb23d7c..a2c3e00274446 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -120,9 +120,6 @@ def main(): handler.setFormatter(formatter) logging.getLogger().addHandler(handler) - with file(os.path.join(ctx.archive, 'config.yaml'), 'w') as f: - yaml.safe_dump(ctx.config, f, default_flow_style=False) - log.debug('\n '.join(['Config:', ] + yaml.safe_dump(ctx.config, default_flow_style=False).splitlines())) ctx.summary = dict(success=True) @@ -146,6 +143,7 @@ def main(): init_tasks.append({'internal.lock_machines': len(ctx.config['roles'])}) init_tasks.extend([ + {'internal.save_config': None}, {'internal.check_lock': None}, {'internal.connect': None}, {'internal.check_conflict': None}, diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 0cb9810fa6920..58e7f14e8a38f 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -94,6 +94,12 @@ def lock_machines(ctx, config): for machine in ctx.config['targets'].iterkeys(): lock.unlock(ctx, machine, ctx.owner) +def save_config(ctx, config): + log.info('Saving configuration') + if ctx.archive is not None: + with file(os.path.join(ctx.archive, 'config.yaml'), 'w') as f: + yaml.safe_dump(ctx.config, f, default_flow_style=False) + def check_lock(ctx, config): log.info('Checking locks...') for machine in ctx.config['targets'].iterkeys(): -- 2.39.5