From 9ae83fa25572a084751c291fad0cb0ebe2ee7633 Mon Sep 17 00:00:00 2001 From: Vasu Kulkarni Date: Thu, 3 Sep 2015 12:23:50 -0400 Subject: [PATCH] Add ansible task to install repo if config provides it If playbook is specificed as shown in doc string usage, It will run ansible task and install the repos so that rpm's can be installed from the provided repo Signed-off-by: Vasu Kulkarni --- teuthology/task/install.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/teuthology/task/install.py b/teuthology/task/install.py index 2a0affe53e..3e949a5c7d 100644 --- a/teuthology/task/install.py +++ b/teuthology/task/install.py @@ -12,6 +12,7 @@ from teuthology import misc as teuthology from teuthology import contextutil, packaging from teuthology.parallel import parallel from ..orchestra import run +from . import ansible log = logging.getLogger(__name__) @@ -1143,7 +1144,12 @@ def task(ctx, config): branch: foo extra_packages: ['samba'] - install: - rhbuild: 1.2.3 + rhbuild: 1.3.0 + playbook: downstream_setup.yml + vars: + yum_repos: + - url: "http://location.repo" + name: "ceph_repo" Overrides are project specific: @@ -1179,13 +1185,17 @@ def task(ctx, config): log.info("Using flavor: %s", flavor) ctx.summary['flavor'] = flavor + nested_tasks = [lambda: rh_install(ctx=ctx, config=config), + lambda: ship_utilities(ctx=ctx, config=None)] if config.get('rhbuild'): - with contextutil.nested( - lambda: rh_install(ctx=ctx, config=config), - lambda: ship_utilities(ctx=ctx, config=None) - ): - yield + if config.get('playbook'): + ansible_config=dict(config) + # remove key not required by ansible task + del ansible_config['rhbuild'] + nested_tasks.insert(0, lambda: ansible.CephLab(ctx,config=ansible_config)) + with contextutil.nested(*nested_tasks): + yield else: with contextutil.nested( lambda: install(ctx=ctx, config=dict( -- 2.39.5