]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
fixes for redhat internal tasks
authorrakeshgm <rakeshgm@redhat.com>
Wed, 13 May 2020 14:51:40 +0000 (20:21 +0530)
committerrakeshgm <rakeshgm@redhat.com>
Fri, 15 May 2020 17:45:23 +0000 (23:15 +0530)
Signed-off-by: rakeshgm <rakeshgm@redhat.com>
teuthology/run.py
teuthology/task/internal/__init__.py
teuthology/task/internal/git_ignore_ssl.py [new file with mode: 0644]
teuthology/task/internal/redhat.py

index 8c59396b0e133898a17199a456c944afe492bc81..3476b8069dc43c758da307d6774b4a1123db9d1c 100644 (file)
@@ -220,11 +220,21 @@ def get_initial_tasks(lock, config, machine_type):
         ])
     init_tasks.append({'internal.timer': None})
 
+    # install_latest_rh_kernel is used for redhat config
+    if 'redhat' not in config:
+        if 'kernel' in config:
+            init_tasks.append({'kernel': config['kernel']})
+
     if 'roles' in config:
         init_tasks.extend([
             {'pcp': None},
             {'selinux': None},
         ])
+
+    if 'redhat' in config:
+        init_tasks.extend([
+            {'internal.setup_stage_cdn': None}])
+
     if config.get('ceph_cm_ansible', True):
         init_tasks.append({'ansible.cephlab': None})
 
@@ -234,6 +244,7 @@ def get_initial_tasks(lock, config, machine_type):
 
     if 'redhat' in config:
         init_tasks.extend([
+            {'internal.git_ignore_ssl': None},
             {'internal.setup_cdn_repo': None},
             {'internal.setup_base_repo': None},
             {'internal.setup_additional_repo': None},
index 2c758bf08e38b027e2abc867f989a4194b90778d..3b552127d2a64b68e5dfc003450eda77fad4672f 100644 (file)
@@ -19,6 +19,8 @@ from teuthology.config import config as teuth_config
 from teuthology.exceptions import VersionNotFoundError
 from teuthology.job_status import get_status, set_status
 from teuthology.orchestra import cluster, remote, run
+# the below import with noqa is to workaround run.py which does not support multilevel submodule import
+from teuthology.task.internal.redhat import setup_cdn_repo, setup_base_repo, setup_additional_repo, setup_stage_cdn  # noqa
 
 log = logging.getLogger(__name__)
 
diff --git a/teuthology/task/internal/git_ignore_ssl.py b/teuthology/task/internal/git_ignore_ssl.py
new file mode 100644 (file)
index 0000000..b7bfa3a
--- /dev/null
@@ -0,0 +1,22 @@
+import contextlib
+import logging
+
+from teuthology.orchestra import run
+
+log = logging.getLogger(__name__)
+
+
+@contextlib.contextmanager
+def git_ignore_ssl(ctx, config):
+    """
+    Ignore ssl error's while cloning from untrusted http
+    """
+
+    log.info("ignoring ssl errors while cloning http repo")
+    ctx.cluster.run(
+            args=[
+                  'sudo', 'git', 'config', run.Raw('--system'),
+                  'http.sslverify', 'false'
+                ],
+        )
+    yield
index 99929110d982f12b73b241c396dc370d235a350d..6310074d53469e125576a611fca39615cbf806fe 100644 (file)
@@ -24,7 +24,7 @@ def setup_stage_cdn(ctx, config):
         raise ConfigError("Provide rhbuild attribute")
     teuthconfig.rhbuild = str(rhbuild)
     with parallel() as p:
-        for remote in ctx.cluster.remotes.iterkeys():
+        for remote in ctx.cluster.remotes.keys():
             if remote.os.name == 'rhel':
                 log.info("subscribing stage cdn on : %s", remote.shortname)
                 p.spawn(_subscribe_stage_cdn, remote)
@@ -32,7 +32,7 @@ def setup_stage_cdn(ctx, config):
         yield
     finally:
         with parallel() as p:
-            for remote in ctx.cluster.remotes.iterkeys():
+            for remote in ctx.cluster.remotes.keys():
                 p.spawn(_unsubscribe_stage_cdn, remote)
 
 
@@ -187,7 +187,7 @@ def _setup_latest_repo(ctx, config):
                 # create base repo
                 if base_url.startswith('http'):
                     repo_to_use = _get_repos_to_use(base_url, repos)
-                    base_repo_file = NamedTemporaryFile(delete=False)
+                    base_repo_file = NamedTemporaryFile(mode='w', delete=False)
                     _create_temp_repo_file(repo_to_use, base_repo_file)
                     remote.put_file(base_repo_file.name, base_repo_file.name)
                     remote.run(args=['sudo', 'cp', base_repo_file.name,