From: rakeshgm Date: Wed, 13 May 2020 14:51:40 +0000 (+0530) Subject: fixes for redhat internal tasks X-Git-Tag: 1.1.0~109^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d25d7b54a919e439c968b332c4357e3f8124ea0d;p=teuthology.git fixes for redhat internal tasks Signed-off-by: rakeshgm --- diff --git a/teuthology/run.py b/teuthology/run.py index 8c59396b..3476b806 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -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}, diff --git a/teuthology/task/internal/__init__.py b/teuthology/task/internal/__init__.py index 2c758bf0..3b552127 100644 --- a/teuthology/task/internal/__init__.py +++ b/teuthology/task/internal/__init__.py @@ -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 index 00000000..b7bfa3ad --- /dev/null +++ b/teuthology/task/internal/git_ignore_ssl.py @@ -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 diff --git a/teuthology/task/internal/redhat.py b/teuthology/task/internal/redhat.py index 99929110..6310074d 100644 --- a/teuthology/task/internal/redhat.py +++ b/teuthology/task/internal/redhat.py @@ -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,