From 55fad94ab1850aefa7f199288c97d41a0a3fd17f Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 10 Mar 2014 00:25:32 -0700 Subject: [PATCH] rgw: create clients in all zones when regions are used Signed-off-by: Josh Durgin --- teuthology/task/rgw.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/teuthology/task/rgw.py b/teuthology/task/rgw.py index 9805c6a4eeaf9..f050baae6b398 100644 --- a/teuthology/task/rgw.py +++ b/teuthology/task/rgw.py @@ -419,7 +419,7 @@ def fill_in_endpoints(region_info, role_zones, role_endpoints): region_conf['zones'].append(zone_payload) @contextlib.contextmanager -def configure_users(ctx, config): +def configure_users(ctx, config, everywhere=False): """ Create users by remotely running rgwadmin commands using extracted user information. @@ -431,14 +431,21 @@ def configure_users(ctx, config): if not c_config: continue user_info = extract_user_info(c_config) + if not user_info: + continue - # if user_info was successfully parsed, use it to create a user - if user_info is not None: + # For data sync the master zones and regions must have the + # system users of the secondary zones. To keep this simple, + # just create the system users on every client if regions are + # configured. + clients_to_create_as = [client] + if everywhere: + clients_to_create_as = config.keys() + for client_name in clients_to_create_as: log.debug('Creating user {user} on {client}'.format( user=user_info['system_key']['user'],client=client)) - rgwadmin(ctx, client, + rgwadmin(ctx, client_name, cmd=[ - '-n', client, 'user', 'create', '--uid', user_info['system_key']['user'], '--access-key', user_info['system_key']['access_key'], @@ -665,6 +672,7 @@ def task(ctx, config): lambda: configure_users( ctx=ctx, config=config, + everywhere=bool(regions), ), lambda: ship_config(ctx=ctx, config=config, role_endpoints=role_endpoints), -- 2.39.5