]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
redhat ds yaml location changed and redhat install tasks to accept lists 1580/head
authorrakeshgm <rakeshgm@redhat.com>
Tue, 27 Oct 2020 13:25:07 +0000 (18:55 +0530)
committerrakeshgm <rakeshgm@redhat.com>
Tue, 10 Nov 2020 18:38:44 +0000 (00:08 +0530)
fetch the dowstream yaml location from
downstream teuth_config and redhat install tasks
to accept lists too

Signed-off-by: rakeshgm <rakeshgm@redhat.com>
teuthology/task/install/redhat.py
teuthology/task/internal/redhat.py

index 08568bda81e30bed01f348a719da6b5088dff7ee..7bf1b5ebd0987cf1841e3cbe84390167ba682514 100644 (file)
@@ -6,6 +6,7 @@ import os
 from teuthology import packaging
 from teuthology.orchestra import run
 from teuthology.parallel import parallel
+from teuthology.config import config as teuth_config
 
 log = logging.getLogger(__name__)
 
@@ -40,28 +41,21 @@ def install(ctx, config):
              - ceph-osd
              - ceph-mds
     """
-    yaml_path = None
-    # Look for rh specific packages in <suite_path>/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))
+    # Look for rh specific packages
+    ds_yaml = os.path.join(
+        teuth_config.get('ds_yaml_dir'),
+        config.get('rhbuild') + ".yaml",
+    )
+    if not os.path.exists(ds_yaml):
+        raise FileNotFoundError(f'Downstream rh version yaml file missing: {ds_yaml}')
+    log.info("using yaml path %s", ds_yaml)
+    downstream_config = yaml.safe_load(open(ds_yaml))
     rh_versions = downstream_config.get('versions', dict()).get('supported', [])
-    external_config = dict(extra_system_packages=config.get('extra_system_packages', {}),
-                           extra_packages=config.get('extra_packages', {}),
+    external_config = dict(extra_system_packages=config.get('extra_system_packages'),
+                           extra_packages=config.get('extra_packages'),
                            )
     downstream_config.update(external_config)
-    version = config['rhbuild']
+    version = config.get('rhbuild')
     if version in rh_versions:
         log.info("%s is a supported version", version)
     else:
@@ -95,10 +89,16 @@ def install_pkgs(ctx, remote, version, downstream_config):
     :param downstream_config the dict object that has downstream pkg info
     """
     rh_version_check = downstream_config.get('versions').get('rpm').get('mapped')
-    rh_rpm_pkgs = downstream_config.get('pkgs').get('rpm') + \
-                  downstream_config.get('extra_system_packages').get('rpm', []) + \
-                  downstream_config.get('extra_packages').get('rpm', [])
+    rh_rpm_pkgs = downstream_config.get('pkgs').get('rpm')
+    extras = [downstream_config.get('extra_system_packages'),
+              downstream_config.get('extra_packages')]
+    for extra in extras:
+        if isinstance(extra, dict):
+            rh_rpm_pkgs += extra.get('rpm', [])
+        elif isinstance(extra, list):
+            rh_rpm_pkgs += extra
     pkgs = str.join(' ', rh_rpm_pkgs)
+
     log.info("Remove any epel packages installed on node %s", remote.shortname)
     # below packages can come from epel and still work, ensure we use cdn pkgs
     remote.run(
@@ -172,9 +172,14 @@ def install_deb_pkgs(
     : param downstream_config the dict object that has downstream pkg info
     """
     rh_version_check = downstream_config.get('versions').get('deb').get('mapped')
-    rh_deb_pkgs = downstream_config.get('pkgs').get('deb') + \
-                  downstream_config.get('extra_system_packages').get('deb', []) + \
-                  downstream_config.get('extra_packages').get('deb', [])
+    rh_deb_pkgs = downstream_config.get('pkgs').get('deb')
+    extras = [downstream_config.get('extra_system_packages'),
+              downstream_config.get('extra_packages')]
+    for extra in extras:
+        if isinstance(extra, dict):
+            rh_deb_pkgs += extra.get('deb', [])
+        elif isinstance(extra, list):
+            rh_deb_pkgs += extra
     pkgs = str.join(' ', rh_deb_pkgs)
     log.info("Installing redhat ceph packages")
     remote.run(args=['sudo', 'apt-get', '-y', 'install',
index c43c9e6c6cc946011371eeb310df6b824caa6599..381b4098986e2ee1f9443f4b3cf372ddc488ac54 100644 (file)
@@ -26,6 +26,11 @@ def setup_stage_cdn(ctx, config):
         raise ConfigError("suite_path missing")
     teuthconfig.suite_path = suite_path
 
+    rhbuild = ctx.config.get('redhat').get('rhbuild')
+    if not rhbuild:
+        raise ConfigError('Provide rhbuild attribute')
+    teuthconfig.rhbuild = str(rhbuild)
+
     with parallel() as p:
         for remote in ctx.cluster.remotes.keys():
             if remote.os.name == 'rhel':
@@ -105,11 +110,10 @@ def setup_additional_repo(ctx, config):
 
 def _enable_rhel_repos(remote):
 
-    # Look for rh specific repos in <suite_path>/rh/downstream.yaml
+    # Look for rh specific repos
     ds_yaml = os.path.join(
-        teuthconfig.suite_path,
-        'rh',
-        'downstream.yaml',
+        teuthconfig.get('ds_yaml_dir'),
+        teuthconfig.rhbuild + ".yaml"
     )
 
     rhel_repos = yaml.safe_load(open(ds_yaml))