]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
use rh/downstream.yaml to define packages
authorVasu Kulkarni <vasu@redhat.com>
Tue, 15 Nov 2016 21:52:06 +0000 (13:52 -0800)
committerVasu Kulkarni <vasu@redhat.com>
Wed, 16 Nov 2016 04:27:11 +0000 (20:27 -0800)
Remove hardcoded checks, use rh/downstream.yaml
from suite dir to define packages to install

Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
teuthology/task/install/redhat.py

index 7debcbbe3f53970cbd4c3270f2f7f7e48f9d3a51..08b0e030e4abe1de6cbacbf214338a9ede53e868 100644 (file)
@@ -1,6 +1,8 @@
 import contextlib
 import logging
 import time
+import yaml
+import os
 
 from cStringIO import StringIO
 
@@ -18,19 +20,56 @@ def install(ctx, config):
 
     :param ctx: the argparse.Namespace object
     :param config: the config dict
+
+    uses yaml defined in qa suite or in users
+    home dir to check for supported versions and
+    packages to install.
+
+    the format of yaml is:
+    versions:
+        supported:
+           - '1.3.0'
+        rpm:
+            mapped:
+               '1.3.0' : '0.94.1'
+        deb:
+            mapped:
+               '1.3.0' : '0.94.1'
+        pkgs:
+            rpm:
+             - ceph-mon
+             - ceph-osd
+            deb:
+             - 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))
+    rh_versions = downstream_config.get('versions', dict()).get('supported', [])
     version = config['rhbuild']
-    rh_versions = ['1.3.0', '1.3.1', '1.3.2', '2.0']
     if version in rh_versions:
         log.info("%s is a supported version", version)
     else:
         raise RuntimeError("Unsupported RH Ceph version %s", version)
-
     with parallel() as p:
         for remote in ctx.cluster.remotes.iterkeys():
             if remote.os.name == 'rhel':
                 log.info("Installing on RHEL node: %s", remote.shortname)
-                p.spawn(install_pkgs, ctx, remote, version)
+                p.spawn(rh_install_pkgs, ctx, remote, version, downstream_config)
             else:
                 log.info("Node %s is not RHEL", remote.shortname)
                 raise RuntimeError("Test requires RHEL nodes")