From: Zack Cerza Date: Tue, 19 May 2015 20:20:18 +0000 (-0600) Subject: Abstract flavor-finding logic into get_flavor() X-Git-Tag: 1.1.0~935^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b7b7b28e332d2fd6db6f1f319e264dfb4ac1b9c;p=teuthology.git Abstract flavor-finding logic into get_flavor() Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/install.py b/teuthology/task/install.py index 08b51c118..3e7779191 100644 --- a/teuthology/task/install.py +++ b/teuthology/task/install.py @@ -1222,6 +1222,31 @@ def ship_utilities(ctx, config): ) +def get_flavor(config): + """ + Determine the flavor to use. + + Flavor tells us what gitbuilder to fetch the prebuilt software + from. It's a combination of possible keywords, in a specific + order, joined by dashes. It is used as a URL path name. If a + match is not found, the teuthology run fails. This is ugly, + and should be cleaned up at some point. + """ + config = config or dict() + flavor = config.get('flavor', 'basic') + + if config.get('path'): + # local dir precludes any other flavors + flavor = 'local' + else: + if config.get('valgrind'): + flavor = 'notcmalloc' + else: + if config.get('coverage'): + flavor = 'gcov' + return flavor + + @contextlib.contextmanager def task(ctx, config): """ @@ -1259,26 +1284,8 @@ def task(ctx, config): teuthology.deep_merge(config, install_overrides.get(project, {})) log.debug('config %s' % config) - # Flavor tells us what gitbuilder to fetch the prebuilt software - # from. It's a combination of possible keywords, in a specific - # order, joined by dashes. It is used as a URL path name. If a - # match is not found, the teuthology run fails. This is ugly, - # and should be cleaned up at some point. - - flavor = config.get('flavor', 'basic') - - if config.get('path'): - # local dir precludes any other flavors - flavor = 'local' - else: - if config.get('valgrind'): - log.info( - 'Using notcmalloc flavor and running some daemons under valgrind') - flavor = 'notcmalloc' - else: - if config.get('coverage'): - log.info('Recording coverage for this run.') - flavor = 'gcov' + flavor = get_flavor(config) + log.info("Using flavor: %s", flavor) ctx.summary['flavor'] = flavor