]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
radosgw-agent: move zone extraction to helper
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 2 Aug 2013 01:56:08 +0000 (18:56 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Fri, 2 Aug 2013 02:12:02 +0000 (19:12 -0700)
This will be useful for other tasks.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
teuthology/task/radosgw-agent.py
teuthology/task_util/rgw.py

index cb9bf7e3d9e2ef89de10ae60a3e4781a8d0ae9da..401c3c2e336f02b724aae506901213321f1af9c8 100644 (file)
@@ -1,5 +1,4 @@
 import contextlib
-from copy import deepcopy
 import logging
 
 from ..orchestra import run
@@ -15,15 +14,8 @@ def run_radosgw_agent(ctx, client, config):
     src_client = config['src']
     dest_client = config['dest']
 
-    ceph_config = ctx.ceph.conf.get('global', {})
-    ceph_config.update(ctx.ceph.conf.get('client', {}))
-    src_ceph_config = deepcopy(ceph_config)
-    src_ceph_config.update(ctx.ceph.conf.get(src_client, {}))
-    dest_ceph_config = deepcopy(ceph_config)
-    dest_ceph_config.update(ctx.ceph.conf.get(dest_client, {}))
-
-    src_zone = src_ceph_config['rgw zone']
-    dest_zone = dest_ceph_config['rgw zone']
+    src_zone = rgw_utils.zone_for_client(ctx, src_client)
+    dest_zone = rgw_utils.zone_for_client(ctx, dest_client)
 
     log.info("source is %s", src_zone)
     log.info("dest is %s", dest_zone)
index 8a0c87e54b7101883545658cdc51a57ee787bd85..c737e29795f7ef769246975cb8cb275b9b7dd12a 100644 (file)
@@ -59,3 +59,9 @@ def get_zone_system_keys(ctx, client, zone):
                                  'zone', 'get', '--rgw-zone', zone])
     system_key = zone_info['system_key']
     return system_key['access_key'], system_key['secret_key']
+
+def zone_for_client(ctx, client):
+    ceph_config = ctx.ceph.conf.get('global', {})
+    ceph_config.update(ctx.ceph.conf.get('client', {}))
+    ceph_config.update(ctx.ceph.conf.get(client, {}))
+    return ceph_config.get('rgw zone')