]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tasks/ceph-deploy: Install appropriate Python version before running
authorOleh Prypin <oleh@pryp.in>
Wed, 22 Jun 2016 16:19:12 +0000 (19:19 +0300)
committerOleh Prypin <oleh@pryp.in>
Wed, 22 Jun 2016 16:19:12 +0000 (19:19 +0300)
Related to RM-15016

Signed-off-by: Oleh Prypin <oleh@pryp.in>
tasks/ceph_deploy.py

index 30ef01d433f1d73f5067a1240d65882bfd916102..ce5e97fbb8d31962026f3bcc18339bb1c5c766dd 100644 (file)
@@ -27,9 +27,38 @@ def download_ceph_deploy(ctx, config):
     will use that instead. The `bootstrap` script is ran, with the argument
     obtained from `python_version`, if specified.
     """
+    ceph_admin = ctx.cluster.only(teuthology.get_first_mon(ctx, config))
+
+    try:
+        py_ver = str(config['python_version'])
+    except KeyError:
+        pass
+    else:
+        supported_versions = ['2', '3']
+        if py_ver not in supported_versions:
+            raise ValueError("python_version must be: {}, not {}".format(
+                ' or '.join(supported_versions), py_ver
+            ))
+
+        log.info("Installing Python")
+        for admin in ceph_admin.remotes:
+            system_type = teuthology.get_system_type(admin)
+
+        if system_type == 'rpm':
+            package = 'python34' if py_ver == '3' else 'python'
+            ctx.cluster.run(args=[
+                'sudo', 'yum', '-y', 'install',
+                package, 'python-virtualenv'
+            ])
+        else:
+            package = 'python3' if py_ver == '3' else 'python'
+            ctx.cluster.run(args=[
+                'sudo', 'apt-get', '-y', '--force-yes', 'install',
+                package, 'python-virtualenv'
+            ])
+
     log.info('Downloading ceph-deploy...')
     testdir = teuthology.get_testdir(ctx)
-    ceph_admin = ctx.cluster.only(teuthology.get_first_mon(ctx, config))
     ceph_deploy_branch = config.get('ceph-deploy-branch', 'master')
 
     ceph_admin.run(