From c23627984d12c595a15e19961f253ad8a4202eab Mon Sep 17 00:00:00 2001 From: Vasu Kulkarni Date: Tue, 15 Nov 2016 13:52:06 -0800 Subject: [PATCH] use rh/downstream.yaml to define packages Remove hardcoded checks, use rh/downstream.yaml from suite dir to define packages to install Signed-off-by: Vasu Kulkarni --- teuthology/task/install/redhat.py | 45 ++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/teuthology/task/install/redhat.py b/teuthology/task/install/redhat.py index 7debcbbe3f..08b0e030e4 100644 --- a/teuthology/task/install/redhat.py +++ b/teuthology/task/install/redhat.py @@ -1,6 +1,8 @@ import contextlib import logging import time +import yaml +import os from cStringIO import StringIO @@ -18,19 +20,56 @@ def install(ctx, config): :param ctx: the argparse.Namespace object :param config: the config dict + + uses yaml defined in qa suite or in users + home dir to check for supported versions and + packages to install. + + the format of yaml is: + versions: + supported: + - '1.3.0' + rpm: + mapped: + '1.3.0' : '0.94.1' + deb: + mapped: + '1.3.0' : '0.94.1' + pkgs: + rpm: + - ceph-mon + - ceph-osd + deb: + - ceph-osd + - ceph-mds """ + yaml_path = None + # Look for rh specific packages in /rh/downstream.yaml + if 'suite_path' in ctx.config: + ds_yaml = os.path.join( + ctx.config['suite_path'], + 'rh', + 'downstream.yaml', + ) + if os.path.exists(ds_yaml): + yaml_path = ds_yaml + # default to user home dir if one exists + default_yaml = os.path.expanduser('~/downstream.yaml') + if os.path.exists(default_yaml): + yaml_path = default_yaml + log.info("using yaml path %s", yaml_path) + downstream_config = yaml.safe_load(open(yaml_path)) + rh_versions = downstream_config.get('versions', dict()).get('supported', []) version = config['rhbuild'] - rh_versions = ['1.3.0', '1.3.1', '1.3.2', '2.0'] if version in rh_versions: log.info("%s is a supported version", version) else: raise RuntimeError("Unsupported RH Ceph version %s", version) - with parallel() as p: for remote in ctx.cluster.remotes.iterkeys(): if remote.os.name == 'rhel': log.info("Installing on RHEL node: %s", remote.shortname) - p.spawn(install_pkgs, ctx, remote, version) + p.spawn(rh_install_pkgs, ctx, remote, version, downstream_config) else: log.info("Node %s is not RHEL", remote.shortname) raise RuntimeError("Test requires RHEL nodes") -- 2.39.5