From cb39100119aaf9300454c81b0a905b4ca10aea61 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 17 May 2023 16:21:37 -0400 Subject: [PATCH] task: install supports enable_coprs array enable the installation of packages in fedora copr repositories Signed-off-by: Casey Bodley --- teuthology/task/install/__init__.py | 7 +++++++ teuthology/task/install/rpm.py | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/teuthology/task/install/__init__.py b/teuthology/task/install/__init__.py index 686ab5e0..0f1bb63d 100644 --- a/teuthology/task/install/__init__.py +++ b/teuthology/task/install/__init__.py @@ -458,6 +458,12 @@ def task(ctx, config): are welcome to add support for other distros. + Enable Fedora copr repositories using enable_coprs: + + - install: + enable_coprs: [ceph/el9] + + Overrides are project specific: overrides: @@ -599,6 +605,7 @@ def task(ctx, config): extra_packages=config.get('extra_packages', []), extra_system_packages=config.get('extra_system_packages', []), extras=config.get('extras', None), + enable_coprs=config.get('enable_coprs', []), flavor=flavor, install_ceph_packages=config.get('install_ceph_packages', True), packages=config.get('packages', dict()), diff --git a/teuthology/task/install/rpm.py b/teuthology/task/install/rpm.py index f11fd8bc..db057e6c 100644 --- a/teuthology/task/install/rpm.py +++ b/teuthology/task/install/rpm.py @@ -173,6 +173,13 @@ def _update_package_list_and_install(ctx, remote, rpm, config): :param rpm: list of packages names to install :param config: the config dict """ + + enable_coprs = config.get('enable_coprs', []) + if len(enable_coprs): + remote.run(args=['sudo', 'dnf', '-y', 'install', 'dnf-command(copr)']) + for copr in enable_coprs: + remote.run(args=['sudo', 'dnf', '-y', 'copr', 'enable', copr]) + # rpm does not force installation of a particular version of the project # packages, so we can put extra_system_packages together with the rest system_pkglist = config.get('extra_system_packages') @@ -368,6 +375,8 @@ def _remove_sources_list(ctx, config, remote): if remote.os.name not in ['opensuse', 'sle']: _yum_unset_check_obsoletes(remote) + for copr in config.get('enable_coprs', []): + remote.run(args=['sudo', 'dnf', '-y', 'copr', 'disable', copr]) def _upgrade_packages(ctx, config, remote, pkgs): """ -- 2.47.3