From: Gregory Meno Date: Thu, 24 Apr 2014 20:18:59 +0000 (-0700) Subject: Moves node: remote mapping to the internal task. X-Git-Tag: 1.1.0~1514 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1532af440e5cee3eaabdc83570e048fb9925a13b;p=teuthology.git Moves node: remote mapping to the internal task. --- diff --git a/teuthology/task/interactive.py b/teuthology/task/interactive.py index a38411577..dd1676e49 100644 --- a/teuthology/task/interactive.py +++ b/teuthology/task/interactive.py @@ -6,8 +6,6 @@ import readline import rlcompleter rlcompleter.__name__ # silence pyflakes import pprint -import yaml -import os readline.parse_and_bind('tab: complete') @@ -30,11 +28,6 @@ def task(ctx, config): - interactive: """ - # TODO perhaps this would be better in the install task - if ctx.archive is not None: - with file(os.path.join(ctx.archive, 'cluster.yaml'), 'w') as f: - yaml.safe_dump({'cluster': dict([(x.name,y) for x,y in ctx.cluster.remotes.iteritems()])}, f, default_flow_style=False) - pp = pprint.PrettyPrinter().pprint code.interact( banner='Ceph test interactive mode, use ctx to interact with the cluster, press control-D to exit...', diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index d4df0b45a..b13abfb3b 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -231,6 +231,22 @@ def connect(ctx, config): for rem in remotes: ctx.cluster.add(rem, rem.name) + if hasattr(ctx, 'archive'): # connect is called in many invocations e.g. -nuke. We don't want write this then + serialize_remote_roles(ctx) + +def serialize_remote_roles(ctx): + """ + Provides an explicit mapping for which remotes have been assigned what roles + So that other software can be loosely coupled to teuthology + """ + assert hasattr(ctx, 'archive') + + if ctx.archive is not None: + with file(os.path.join(ctx.archive, 'info.yaml'), 'a') as info: + role_map = {'cluster': dict([(remote.name, {'roles': roles}) for remote, roles in ctx.cluster.remotes.iteritems()])} + yaml.safe_dump(role_map, info, default_flow_style=False) + + def check_ceph_data(ctx, config): """ Check for old /var/lib/ceph directories and detect staleness.