From 2eb7070c500885d02293eaaba2d21744316da751 Mon Sep 17 00:00:00 2001 From: rakeshgm Date: Tue, 28 Jul 2020 15:05:01 +0530 Subject: [PATCH] read redhat repos list from downstream.yaml Signed-off-by: rakeshgm --- teuthology/task/internal/redhat.py | 34 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/teuthology/task/internal/redhat.py b/teuthology/task/internal/redhat.py index 6310074d53..34af8659fb 100644 --- a/teuthology/task/internal/redhat.py +++ b/teuthology/task/internal/redhat.py @@ -4,6 +4,8 @@ Internal tasks for redhat downstream builds import contextlib import logging import requests +import yaml +import os from tempfile import NamedTemporaryFile from teuthology.config import config as teuthconfig from teuthology.parallel import parallel @@ -19,10 +21,11 @@ def setup_stage_cdn(ctx, config): """ Configure internal stage cdn """ - rhbuild = ctx.config.get('redhat').get('rhbuild') - if not rhbuild: - raise ConfigError("Provide rhbuild attribute") - teuthconfig.rhbuild = str(rhbuild) + suite_path = ctx.config.get('suite_path') + if not suite_path: + raise ConfigError("suite_path missing") + teuthconfig.suite_path = suite_path + with parallel() as p: for remote in ctx.cluster.remotes.keys(): if remote.os.name == 'rhel': @@ -101,23 +104,18 @@ def setup_additional_repo(ctx, config): def _enable_rhel_repos(remote): - rhel_7_rpms = ['rhel-7-server-rpms', - 'rhel-7-server-optional-rpms', - 'rhel-7-server-extras-rpms'] - - rhel_8_rpms = ['rhel-8-for-x86_64-appstream-rpms', - 'rhel-8-for-x86_64-baseos-rpms', - 'ansible-2.8-for-rhel-8-x86_64-rpms'] - if teuthconfig.rhbuild.startswith("3"): - rhel_7_rpms.append('rhel-7-server-ansible-2.6-rpms') - elif teuthconfig.rhbuild.startswith("4"): - rhel_7_rpms.append('rhel-7-server-ansible-2.8-rpms') + # Look for rh specific repos in /rh/downstream.yaml + ds_yaml = os.path.join( + teuthconfig.suite_path, + 'rh', + 'downstream.yaml', + ) - repos_to_subscribe = {'7': rhel_7_rpms, - '8': rhel_8_rpms} + rhel_repos = yaml.safe_load(open(ds_yaml)) + repos_to_subscribe = rhel_repos.get('rhel_repos').get(remote.os.version[0]) - for repo in repos_to_subscribe.get(remote.os.version[0]): + for repo in repos_to_subscribe: remote.run(args=['sudo', 'subscription-manager', 'repos', '--enable={r}'.format(r=repo)]) -- 2.39.5