]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
use downstream.yaml to install packages and version check
authorVasu Kulkarni <vasu@redhat.com>
Tue, 15 Nov 2016 21:55:57 +0000 (13:55 -0800)
committerVasu Kulkarni <vasu@redhat.com>
Wed, 16 Nov 2016 04:27:11 +0000 (20:27 -0800)
remove hardcoded checks instead use downstream.yaml
defined in suites dir rh/downstream.yaml
for packages and version checks

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

index 08b0e030e4abe1de6cbacbf214338a9ede53e868..2b529ca7f528213d00510f9da00721ae2c6113d7 100644 (file)
@@ -95,75 +95,37 @@ def uninstall(ctx, config):
             p.spawn(uninstall_pkgs, ctx, remote)
 
 
-def install_pkgs(ctx, remote, installed_version):
+def rh_install_pkgs(ctx, remote, version, downstream_config):
     """
     Installs RH build using ceph-deploy.
 
     :param ctx: the argparse.Namespace object
     :param remote: the teuthology.orchestra.remote.Remote object
+    :param downstream_config the dict object that has downstream pkg info
     """
-    pkgs = ['ceph-deploy']
-    # install ceph-selinux for 1.3.2 as its not dependency of any core packages
-    if (installed_version == '1.3.2'):
-        pkgs.append('ceph-selinux')
-    # install ceph-fuse for 2.0 as its not dependency of any core packages
-    if (installed_version == '2.0'):
-        pkgs.append('ceph-fuse')
-    rh_version_check = {'0.94.1': '1.3.0', '0.94.3': '1.3.1',
-                        '0.94.5': '1.3.2', '10.1.0': '2.0'}
+    rh_version_check = downstream_config.get('versions').get('rpm').get('mapped')
+    rh_rpm_pkgs = downstream_config.get('pkgs').get('rpm')
+    pkgs = str.join(' ', rh_rpm_pkgs)
     log.info("Remove any epel packages installed on node %s", remote.shortname)
     remote.run(
-        args=['sudo', 'yum', 'remove',
-              run.Raw("leveldb xmlstarlet fcgi"), '-y'],
-        check_status=False
-    )
-    for pkg in pkgs:
-        log.info("Check if %s is already installed on node %s",
-                 pkg, remote.shortname)
-        remote.run(args=['sudo', 'yum', 'clean', 'metadata'])
-        r = remote.run(
-            args=['yum', 'list', 'installed', run.Raw(pkg)],
-            stdout=StringIO(),
-            check_status=False,
-        )
-        if r.stdout.getvalue().find(pkg) == -1:
-            log.info("Installing %s " % pkg)
-            remote.run(args=['sudo', 'yum', 'install', pkg, '-y'])
-        else:
-            log.info("Removing and reinstalling %s on %s",
-                     pkg, remote.shortname)
-            remote.run(args=['sudo', 'yum', 'remove', pkg, '-y'])
-            remote.run(args=['sudo', 'yum', 'install', pkg, '-y'])
-
-    log.info("Check if ceph is already installed on %s", remote.shortname)
-    r = remote.run(
-        args=['yum', 'list', 'installed', 'ceph'],
-        stdout=StringIO(),
-        check_status=False,
-    )
-    host = r.hostname
-    if r.stdout.getvalue().find('ceph') == -1:
-        log.info("Install ceph using ceph-deploy on %s", remote.shortname)
-        remote.run(args=[
-            'sudo', 'ceph-deploy', 'install',
-            run.Raw('--no-adjust-repos'), host]
-        )
-        remote.run(args=['sudo', 'yum', 'install', 'ceph-test', '-y'])
-    else:
-        log.info("Removing and reinstalling Ceph on %s", remote.shortname)
-        remote.run(args=['sudo', 'ceph-deploy', 'uninstall', host])
-        remote.run(args=['sudo', 'ceph-deploy', 'purgedata', host])
-        remote.run(args=['sudo', 'ceph-deploy', 'install', host])
-        remote.run(args=['sudo', 'yum', 'remove', 'ceph-test', '-y'])
-        remote.run(args=['sudo', 'yum', 'install', 'ceph-test', '-y'])
-
+        args=[
+            'sudo',
+            'yum',
+            'remove',
+            run.Raw("leveldb xmlstarlet fcgi"),
+            '-y'],
+        check_status=False)
+    log.info("Installing redhat ceph packages")
+    remote.run(args=['sudo', 'yum', '-y', 'install',
+                     run.Raw(pkgs)])
     # check package version
-    version = packaging.get_package_version(remote, 'ceph-common')
+    installed_version = packaging.get_package_version(remote, 'ceph-common')
     log.info(
         "Node: {n} Ceph version installed is {v}".format(
-            n=remote.shortname, v=version)
-    )
-    if rh_version_check[version] == installed_version:
+            n=remote.shortname,
+            v=version))
+    req_ver = rh_version_check[version]
+    if installed_version.startswith(req_ver):
         log.info("Installed version matches on %s", remote.shortname)
     else:
         raise RuntimeError("Version check failed on node %s", remote.shortname)