]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
read redhat repos list from downstream.yaml 1543/head
authorrakeshgm <rakeshgm@redhat.com>
Tue, 28 Jul 2020 09:35:01 +0000 (15:05 +0530)
committerrakeshgm <rakeshgm@redhat.com>
Mon, 3 Aug 2020 13:32:44 +0000 (19:02 +0530)
Signed-off-by: rakeshgm <rakeshgm@redhat.com>
teuthology/task/internal/redhat.py

index 6310074d53469e125576a611fca39615cbf806fe..34af8659fbfbcce622ad3eb9f61148e161df9d88 100644 (file)
@@ -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 <suite_path>/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)])