import rlcompleter
rlcompleter.__name__ # silence pyflakes
import pprint
-import yaml
-import os
readline.parse_and_bind('tab: complete')
- 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...',
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.