From 966bccc8ec32e9e96f46e804a1e9aafb32cbeefc Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Wed, 16 Apr 2025 16:02:12 +0200 Subject: [PATCH] task/install: do not duplicate package names Get rid of package names duplication when extra_system_packages provided for rpm. For example, when it is requested 'bzip2' and 'perl-Test-Harness' to be installed as extra system packages, there can be observed 5 times mentioning of the packages, see the log excerpt: 2025-04-09T12:30:08.360 INFO:teuthology.task.install.rpm:Installing packages: ceph-radosgw, ceph-test, ceph, ceph-base, cephadm, ceph-immutable-object-cache, ceph-mgr, ceph-mgr-dashboard, ceph-mgr-diskprediction-local, ceph-mgr-rook, ceph-mgr-cephadm, ceph-fuse, ceph-volume, librados-devel, libcephfs2, libcephfs-devel, librados2, librbd1, python3-rados, python3-rgw, python3-cephfs, python3-rbd, rbd-fuse, rbd-mirror, rbd-nbd, bzip2, perl-Test-Harness, bzip2, perl-Test-Harness, bzip2, perl-Test-Harness, bzip2, perl-Test-Harness, bzip2, perl-Test-Harness on remote rpm x86_64 Signed-off-by: Kyr Shatskyy --- teuthology/task/install/rpm.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/teuthology/task/install/rpm.py b/teuthology/task/install/rpm.py index db057e6c7..0c3e697b1 100644 --- a/teuthology/task/install/rpm.py +++ b/teuthology/task/install/rpm.py @@ -179,15 +179,15 @@ def _update_package_list_and_install(ctx, remote, rpm, config): remote.run(args=['sudo', 'dnf', '-y', 'install', 'dnf-command(copr)']) for copr in enable_coprs: remote.run(args=['sudo', 'dnf', '-y', 'copr', 'enable', copr]) - + packages = list(rpm) # 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') if system_pkglist: if isinstance(system_pkglist, dict): - rpm += system_pkglist.get('rpm') + packages += system_pkglist.get('rpm') else: - rpm += system_pkglist + packages += system_pkglist remote_os = remote.os dist_release = remote_os.name @@ -220,19 +220,19 @@ def _update_package_list_and_install(ctx, remote, rpm, config): # install it separately because, otherwise, ceph-test cannot be # installed (even with --force) when there are several conflicting # repos from different vendors. - rpm = ["librados2", "ceph-test"] + packages = ["librados2", "ceph-test"] # 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', []) if system_pkglist: if isinstance(system_pkglist, dict): - rpm += system_pkglist.get('rpm') + packages += system_pkglist.get('rpm') else: - rpm += system_pkglist + packages += system_pkglist log.info("Installing packages: {pkglist} on remote rpm {arch}".format( - pkglist=", ".join(rpm), arch=remote.arch)) + pkglist=", ".join(packages), arch=remote.arch)) if dist_release not in ['opensuse', 'sle']: project = builder.project @@ -257,15 +257,15 @@ def _update_package_list_and_install(ctx, remote, rpm, config): install_cmd = 'sudo yum -y install' # to compose version string like "0.94.10-87.g116a558.el7" pkg_version = '.'.join([builder.version, builder.dist_release]) - rpm = _downgrade_packages(ctx, remote, rpm, pkg_version, config) + packages = _downgrade_packages(ctx, remote, packages, pkg_version, config) if system_pkglist: _retry_if_failures_are_recoverable(remote, args='{install_cmd} {rpms}' - .format(install_cmd=install_cmd, rpms=' '.join(rpm)) + .format(install_cmd=install_cmd, rpms=' '.join(packages)) ) else: - for cpack in rpm: + for cpack in packages: if ldir: _retry_if_failures_are_recoverable(remote, args=''' -- 2.47.3