]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Changes invocation of serialize_remote_roles to internal task to avoid being run... 237/head
authorGregory Meno <gregory.meno@inktank.com>
Tue, 29 Apr 2014 11:20:51 +0000 (04:20 -0700)
committerGregory Meno <gregory.meno@inktank.com>
Tue, 29 Apr 2014 12:09:07 +0000 (05:09 -0700)
teuthology/run.py
teuthology/task/internal.py

index 42146edf53c567667db14eeee719f2d5c9314acc..e828e375b088bd7bb816c3fcc571ab53ee3ccad8 100644 (file)
@@ -134,6 +134,7 @@ def main(ctx):
         {'internal.save_config': None},
         {'internal.check_lock': None},
         {'internal.connect': None},
+        {'internal.serialize_remote_roles': None},
         {'internal.check_conflict': None},
     ])
     if not ctx.config.get('use_existing_cluster', False):
index b13abfb3b832344701d3c5e941c9a8b204400698..533d98a3ab1fa1e8b73f17cdfdc288b5b976a334 100644 (file)
@@ -231,20 +231,18 @@ 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):
+def serialize_remote_roles(ctx, config):
     """
     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)
+        with file(os.path.join(ctx.archive, 'info.yaml'), 'r+') as info_file:
+            info_yaml = yaml.safe_load(info_file)
+            info_file.seek(0)
+            info_yaml['cluster'] = dict([(remote.name, {'roles': roles}) for remote, roles in ctx.cluster.remotes.iteritems()])
+            yaml.safe_dump(info_yaml, info_file, default_flow_style=False)
 
 
 def check_ceph_data(ctx, config):