From 9ccf0381f66289992dac3cc14474f7110b843777 Mon Sep 17 00:00:00 2001 From: rakeshgm Date: Tue, 28 Jul 2020 14:37:01 +0530 Subject: [PATCH] get the repos from downstream.yaml instead of hardcoding here. Signed-off-by: rakeshgm --- teuthology/task/internal/redhat.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/teuthology/task/internal/redhat.py b/teuthology/task/internal/redhat.py index 6310074d5..74e90df10 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 @@ -23,6 +25,7 @@ def setup_stage_cdn(ctx, config): if not rhbuild: raise ConfigError("Provide rhbuild attribute") teuthconfig.rhbuild = str(rhbuild) + teuthconfig.suite_path = ctx.config.get('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'] + # Look for rh specific repos in /rh/downstream.yaml + ds_yaml = os.path.join( + teuthconfig.suite_path, + 'rh', + 'downstream.yaml', + ) - 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') + rhel_repos = yaml.safe_load(open(ds_yaml)) + repos_to_subscribe = rhel_repos.get('rhel_repos').get(remote.os.version[0]) - repos_to_subscribe = {'7': rhel_7_rpms, - '8': rhel_8_rpms} - - 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.47.3