From: rakeshgm Date: Tue, 28 Jul 2020 09:07:01 +0000 (+0530) Subject: get the repos from downstream.yaml instead of hardcoding here. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fheads%2Frm-repos;p=teuthology.git get the repos from downstream.yaml instead of hardcoding here. Signed-off-by: rakeshgm --- 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)])