From 761d76937d09e21073ccf56925c1028a8ca716b9 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 15 Apr 2014 17:02:33 -0500 Subject: [PATCH] Don't run apache functions if not using apache Signed-off-by: Zack Cerza --- teuthology/task/rgw.py | 63 ++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/teuthology/task/rgw.py b/teuthology/task/rgw.py index 1f1058eef7..ebff51a4e7 100644 --- a/teuthology/task/rgw.py +++ b/teuthology/task/rgw.py @@ -764,24 +764,45 @@ def task(ctx, config): del config['frontend'] log.info("Using %s as radosgw frontend", ctx.rgw.frontend) - with contextutil.nested( - lambda: create_apache_dirs(ctx=ctx, config=config), - lambda: configure_regions_and_zones( - ctx=ctx, - config=config, - regions=regions, - role_endpoints=role_endpoints, - ), - lambda: configure_users( - ctx=ctx, - config=config, - everywhere=bool(regions), - ), - lambda: create_nonregion_pools( - ctx=ctx, config=config, regions=regions), - lambda: ship_apache_configs(ctx=ctx, config=config, - role_endpoints=role_endpoints), - lambda: start_rgw(ctx=ctx, config=config), - lambda: start_apache(ctx=ctx, config=config), - ): - yield + if ctx.rgw.frontend == 'apache': + with contextutil.nested( + lambda: create_apache_dirs(ctx=ctx, config=config), + lambda: configure_regions_and_zones( + ctx=ctx, + config=config, + regions=regions, + role_endpoints=role_endpoints, + ), + lambda: configure_users( + ctx=ctx, + config=config, + everywhere=bool(regions), + ), + lambda: create_nonregion_pools( + ctx=ctx, config=config, regions=regions), + lambda: ship_apache_configs(ctx=ctx, config=config, + role_endpoints=role_endpoints), + lambda: start_rgw(ctx=ctx, config=config), + lambda: start_apache(ctx=ctx, config=config), + ): + yield + elif ctx.rgw.frontend == 'civetweb': + with contextutil.nested( + lambda: configure_regions_and_zones( + ctx=ctx, + config=config, + regions=regions, + role_endpoints=role_endpoints, + ), + lambda: configure_users( + ctx=ctx, + config=config, + everywhere=bool(regions), + ), + lambda: create_nonregion_pools( + ctx=ctx, config=config, regions=regions), + lambda: start_rgw(ctx=ctx, config=config), + ): + yield + else: + raise ValueError("frontend must be 'apache' or 'civetweb'") -- 2.39.5