pyinfra-dev / pyinfra

pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.
https://pyinfra.com
MIT License
3.85k stars 374 forks source link

Yum package reinstalled, even though it is already installed #839

Closed julienlavergne closed 1 year ago

julienlavergne commented 2 years ago

Describe the bug

yum.packages sometimes does reinstall a package even when it is already installed.

I tracked does the behavior to he function _has_package in pyinfra/operations/util/packaging.py.

In my case, the variable packages contains 'gcc-c++': {'4.8.5-44.el7'} and the variable packages_to_check is [['gcc-c++', '4.8.3-9.el7'], ['gcc-c++', '4.8.5-16.el7_4.2'], ['gcc-c++', '4.8.5-28.el7_5.1'], ['gcc-c++', '4.8.5-44.el7'], ['gcc-c++', '4.8.5-36.el7_6.1'], ['gcc-c++', '4.8.5-36.el7'], ['gcc-c++', '4.8.5-36.el7_6.2'], ['gcc-c++', '4.8.5-11.el7'], ['gcc-c++', '4.8.2-16.2.el7_0'], ['gcc-c++', '4.8.5-16.el7'], ['gcc-c++', '4.8.2-16.el7'], ['gcc-c++', '4.8.5-4.el7'], ['gcc-c++', '4.8.5-39.el7'], ['gcc-c++', '4.8.5-16.el7_4.1'], ['gcc-c++', '4.8.5-28.el7']]

The function does check that all packages to check are installed, but in my example, only one is required.

To Reproduce

yum.packages(
   _sudo=True,
   packages=["gcc-c++"],
)

Expected behavior

The package is not reinstalled

Meta

v2.2

-vvv --debug

    [pyinfra.api.facts] Getting fact: rpm.RpmPackages () (ensure_hosts: None)
    [pyinfra.connectors.ssh] Running command on host21: (pty=None) sudo -H -n sh -c '! command -v rpm >/dev/null || rpm --queryformat "%{NAME} %{VERSION}-%{RELEASE}\n" -qa'
[host21] >>> sudo -H -n sh -c '! command -v rpm >/dev/null || rpm --queryformat "%{NAME} %{VERSION}-%{RELEASE}\n" -qa'
[host21] python-iniparse 0.4-9.el7
[host21] wpa_supplicant 2.6-12.el7_9.2
[host21] cifs-utils 6.2-10.el7
[host21] newt-python 0.52.15-4.el7
[host21] microcode_ctl 2.1-73.11.el7_9
[host21] compat-db47 4.7.25-28.el7
[host21] cracklib-dicts 2.9.0-11.el7
[host21] xfsprogs 4.5.0-22.el7
[host21] pcre 8.32-17.el7
[host21] libpcap-devel 1.5.3-12.el7
[host21] hp-scripting-tools 11.60-20.rhel7
[host21] bzip2-libs 1.0.6-13.el7
[host21] pyparsing 1.5.6-9.el7
[host21] screen 4.1.0-0.27.20120314git3c2946.el7_9
[host21] net-tools 2.0-0.25.20131004git.el7
[host21] libattr 2.4.46-13.el7
[host21] libtool-ltdl 2.4.2-22.el7_3
[host21] python-backports 1.0-8.el7
[host21] glibc 2.17-325.el7_9
[host21] audit-libs 2.8.5-4.el7
[host21] logme 1.0-0036
[host21] python-ipaddress 1.0.16-2.el7
[host21] pam-devel 1.1.8-23.el7
[host21] yum-utils 1.1.31-54.el7_8
[host21] libidn 1.28-4.el7
[host21] grub2-pc-modules 2.02-0.87.el7_9.7
[host21] logrotate 3.8.6-19.el7
[host21] mtr 0.85-7.el7
[host21] libaio 0.3.109-13.el7
[host21] bash 4.2.46-35.el7_9
[host21] fipscheck-lib 1.4.1-6.el7
[host21] hunspell-en 0.20121024-6.el7
[host21] pciutils-libs 3.5.1-3.el7
[host21] perl-macros 5.16.3-299.el7_9
[host21] zip 3.0-11.el7
[host21] perl-Encode 2.51-7.el7
[host21] libuuid 2.23.2-65.el7_9.1
[host21] scl-utils 20130529-19.el7
[host21] perl-Exporter 5.68-3.el7
[host21] coreutils 8.22-24.el7_9.2
[host21] perl-File-Path 2.09-2.el7
[host21] abrt-libs 2.1.11-60.el7
[host21] perl-Test-Harness 3.28-3.el7
[host21] nss-softokn 3.67.0-3.el7_9
[host21] qrencode-libs 3.4.1-3.el7
[host21] man-pages 3.53-5.el7
[host21] perl-Digest 1.17-245.el7
[host21] bind-libs 9.11.4-26.P2.el7_9.9
[host21] cryptsetup-libs 2.0.3-6.el7
[host21] perl-JSON-PP 2.27202-2.el7
[host21] python-firewall 0.6.3-13.el7_9
[host21] libreport 2.1.11-53.el7
[host21] gdb 7.6.1-120.el7
[host21] iputils 20160308-10.el7
[host21] libref_array 0.1.5-32.el7
[host21] perl-Encode-Locale 1.03-5.el7
[host21] rpm 4.11.3-48.el7_9
[host21] polkit 0.112-26.el7_9.1
[host21] libreport-plugin-rhtsupport 2.1.11-53.el7
[host21] sysvinit-tools 2.88-14.dsf.el7
[host21] samba-common-libs 4.10.16-18.el7_9
[host21] nmap-ncat 6.40-19.el7
[host21] sg3_utils-libs 1.37-19.el7
[host21] hwdata 0.252-9.7.el7
[host21] perl-B-Lint 1.17-3.el7
[host21] abrt-addon-ccpp 2.1.11-60.el7
[host21] dmraid-events 1.0.0.rc16-28.el7
[host21] perl-Env 1.04-2.el7
[host21] perl-Locale-Maketext-Simple 0.21-299.el7_9
[host21] kernel 3.10.0-1127.13.1.el7
[host21] perl-local-lib 1.008010-4.el7
[host21] libss 1.42.9-19.el7
[host21] libreport-cli 2.1.11-53.el7
[host21] perl-TimeDate 2.30-2.el7
[host21] libsss_idmap 1.16.5-10.el7_9.12
[host21] perl-DBD-SQLite 1.39-3.el7
[host21] virt-what 1.18-4.el7_9.1
[host21] gdbm-devel 1.10-8.el7
[host21] lvm2-libs 2.02.187-6.el7_9.5
[host21] libdwarf 20130207-4.el7
[host21] plymouth 0.8.9-0.34.20140113.el7
[host21] perl-HTTP-Message 6.06-6.el7
[host21] kernel 3.10.0-1127.19.1.el7
[host21] mozjs17 17.0.0-20.el7
[host21] glibc-headers 2.17-325.el7_9
[host21] emacs-filesystem 24.3-23.el7
[host21] dyninst 9.3.1-3.el7
[host21] kernel 3.10.0-1160.59.1.el7
[host21] kernel-tools 3.10.0-1160.59.1.el7
[host21] p11-kit-trust 0.23.5-3.el7
[host21] tuned 2.11.0-11.el7_9
[host21] gzip 1.5-10.el7
[host21] nscd 2.17-325.el7_9
[host21] shared-mime-info 1.8-5.el7
[host21] basesystem 10.0-7.el7
[host21] libhugetlbfs 2.16-13.el7
[host21] selinux-policy-targeted 3.13.1-268.el7_9.2
[host21] python-gobject-base 3.22.0-1.el7_4.1
[host21] ncurses-libs 5.9-14.20130511.el7_4
[host21] libmpc 1.0.1-3.el7
[host21] tcsh 6.18.01-17.el7_9.1
[host21] python-lxml 3.2.1-4.el7
[host21] info 5.1-5.el7
[host21] sfptpd 3.2.1.1004-3
[host21] libxslt 1.1.28-6.el7
[host21] python-ipaddr 2.1.11-2.el7
[host21] chrony 3.4-1.el7
[host21] libX11 1.6.7-4.el7_9
[host21] python-inotify 0.9.4-4.el7
[host21] biosdevname 0.7.3-2.el7
[host21] json-c 0.11-4.el7_0
[host21] ITECauditvol 1.1-1596
[host21] managesoft 17.0.1-1
[host21] kpatch 0.6.1-6.el7
[host21] grub2-common 2.02-0.87.el7_9.7
[host21] libstdc++-devel 4.8.5-44.el7
[host21] python-schedutils 0.4-6.el7
[host21] tcp_wrappers-libs 7.6-77.el7
[host21] vim-filesystem 7.4.629-8.el7_9
[host21] blktrace 1.0.5-9.el7
[host21] nss-util 3.67.0-1.el7_9
[host21] perl-parent 0.225-244.el7
[host21] elfutils-libelf 0.176-5.el7
[host21] pygpgme 0.3-9.el7
[host21] ed 1.9-4.el7
[host21] libldb 1.5.4-2.el7_9
[host21] dosfstools 3.0.20-10.el7
[host21] perl-constant 1.27-2.el7
[host21] libblkid 2.23.2-65.el7_9.1
[host21] perl-IO-Socket-SSL 1.94-7.el7
[host21] perl-Pod-Simple 3.28-4.el7
[host21] pexpect 2.3-11.el7
[host21] libutempter 1.1.6-4.el7
[host21] dmidecode 3.2-5.el7_9.1
[host21] python-urllib3 1.10.2-7.el7
[host21] ftp 0.17-67.el7
[host21] perl-Locale-Maketext 1.23-3.el7
[host21] python-gofer 2.12.5-7.el7sat
[host21] libXp 1.0.2-2.1.el7
[host21] perl-Compress-Raw-Bzip2 2.061-3.el7
[host21] libcurl 7.29.0-59.el7_9.1
[host21] dbus-glib 0.100-7.el7
[host21] libverto-libevent 0.2.5-4.el7
[host21] systemd 219-78.el7_9.5
[host21] boost-system 1.53.0-28.el7
[host21] abrt-python 2.1.11-60.el7
[host21] trousers 0.3.14-2.el7
[host21] abrt-addon-pstoreoops 2.1.11-60.el7
[host21] libreport-plugin-ureport 2.1.11-53.el7
[host21] ntp-perl 4.2.6p5-29.el7_8.2
[host21] cronie 1.4.11-24.el7_9
[host21] libXt 1.1.5-3.el7
[host21] perl-libxml-perl 0.08-19.el7
[host21] redhat-support-lib-python 0.13.0-0.el7_9
[host21] fprintd 0.8.1-2.el7
[host21] rusers-server 0.17-81.el7
[host21] perl-FCGI 0.74-8.el7
[host21] perl-Time-Piece 1.20.1-299.el7_9
[host21] rpcbind 0.2.0-49.el7
[host21] gpg-pubkey 2fa658e0-45700c69
[host21] perl-Business-ISBN 2.06-2.el7
[host21] cpp 4.8.5-44.el7
[host21] perl-Font-AFM 1.20-13.el7
[host21] libstoragemgmt-python-clibs 1.8.1-2.el7_9
[host21] ipset-libs 7.1-1.el7
[host21] device-mapper-event-libs 1.02.170-6.el7_9.5
[host21] acl 2.2.51-15.el7
[host21] grub2-tools-extra 2.02-0.87.el7_9.7
[host21] abrt-addon-vmcore 2.1.11-60.el7
[host21] perl-libwww-perl 6.05-2.el7
[host21] libconfig 1.4.9-5.el7
[host21] perl-ExtUtils-CBuilder 0.28.2.6-299.el7_9
[host21] pixman 0.34.0-1.el7
[host21] vim-enhanced 7.4.629-8.el7_9
[host21] perl-ExtUtils-ParseXS 3.18-3.el7
[host21] lsscsi 0.27-6.el7
[host21] nfs-utils 1.3.0-0.68.el7.2
[host21] lm_sensors 3.4.0-8.20160601gitf9185e5.el7
[host21] elfutils-libelf-devel 0.176-5.el7
[host21] python-decorator 3.4.0-3.el7
[host21] python-tdb 1.3.18-1.el7
[host21] perl-XML-Twig 3.44-2.el7
[host21] cracklib 2.9.0-11.el7
[host21] langtable 0.0.31-4.el7
[host21] sysstat 10.1.5-19.el7
[host21] pkgconfig 0.27.1-4.el7
[host21] langtable-data 0.0.31-4.el7
[host21] valgrind 3.15.0-11.el7
[host21] ncurses-base 5.9-14.20130511.el7_4
[host21] libhugetlbfs-utils 2.16-13.el7
[host21] kernel-devel 3.10.0-1127.19.1.el7
[host21] authconfig 6.2.8-30.el7
[host21] pam 1.1.8-23.el7
[host21] pciutils 3.5.1-3.el7
[host21] python-ethtool 0.8-8.el7
[host21] psacct 6.6.1-13.el7
[host21] yum-metadata-parser 1.1.4-10.el7
[host21] qmmz 4.2.7-1.el7.20200725
[host21] pyOpenSSL 0.13.1-4.el7
[host21] aic94xx-firmware 30-6.el7
[host21] langtable-python 0.0.31-4.el7
[host21] libdb 5.3.21-25.el7
[host21] at 3.1.13-24.el7
[host21] python-linux-procfs 0.4.11-4.el7
[host21] libacl 2.2.51-15.el7
[host21] hwloc 1.11.8-4.el7
[host21] irqbalance 1.0.7-12.el7
[host21] python-chardet 2.2.1-3.el7
[host21] libgcrypt 1.5.3-14.el7
[host21] LIVEmon 1.0-1218
[host21] parted 3.1-32.el7
[host21] libselinux-python 2.5-15.el7
[host21] libtar 1.2.11-29.el7
[host21] glib2-devel 2.56.1-9.el7_9
[host21] gpg-pubkey b1275ea3-546d1808
[host21] tcpdump 4.9.2-4.el7_7.1
[host21] python-setuptools 0.9.8-7.el7
[host21] libnl-devel 1.1.4-3.el7
[host21] redhat-release-server 7.9-6.el7_9
[host21] libnl3 3.2.28-4.el7
[host21] firewalld-filesystem 0.6.3-13.el7_9
[host21] findutils 4.5.11-6.el7
[host21] subscription-manager-rhsm-certificates 1.24.50-1.el7_9
[host21] btrfs-progs 4.9.1-1.el7
[host21] alsa-lib 1.1.8-1.el7
[host21] xz 5.2.2-1.el7
[host21] glibc-common 2.17-325.el7_9
[host21] wget 1.14-18.el7_6.1
[host21] perl-Net-SSLeay 1.55-6.el7
[host21] hunspell-en-US 0.20121024-6.el7
[host21] zlib 1.2.7-19.el7_9
[host21] sg3_utils 1.37-19.el7
[host21] libmnl 1.0.3-7.el7
[host21] perl 5.16.3-299.el7_9
[host21] gnupg2 2.0.22-5.el7_5
[host21] perl-Pod-Perldoc 3.20-4.el7
[host21] time 1.7-45.el7
[host21] perl-Pod-Usage 1.63-3.el7
[host21] geoipupdate 2.5.0-1.el7
[host21] perl-Storable 2.45-3.el7
[host21] rfkill 0.4-10.el7
[host21] python-pycurl 7.19.0-19.el7
[host21] perl-Time-Local 1.2300-2.el7
[host21] perl-Carp 1.26-244.el7
[host21] redhat-release-eula 7.8-0.el7
[host21] perl-Net-HTTP 6.06-2.el7
[host21] perl-Socket 2.010-5.el7
[host21] ustr 1.0.4-16.el7
[host21] perl-Data-Dumper 2.145-3.el7
[host21] sgpio 1.2.0.10-13.el7
[host21] perl-Compress-Raw-Zlib 2.061-4.el7
[host21] perl-XML-Parser 2.41-10.el7
[host21] kmod 20-28.el7
[host21] perl-CPAN-Meta-YAML 0.008-14.el7
[host21] compat-libstdc++-33 3.2.3-72.el7
[host21] perl-Digest-MD5 2.52-3.el7
[host21] compat-libstdc++-33 3.2.3-72.el7
[host21] perl-CPAN-Meta 2.120921-5.el7
[host21] libXau 1.0.8-2.1.el7
[host21] perl-Module-Load-Conditional 0.54-3.el7
[host21] libXext 1.3.3-3.el7
[host21] perl-Term-UI 0.36-2.el7
[host21] ncompress 4.2.4.4-3.1.el7_8
[host21] libevent 2.0.21-4.el7
[host21] dbus-python 1.1.1-9.el7
[host21] libnl3-cli 3.2.28-4.el7
[host21] libpath_utils 0.2.1-32.el7
[host21] policycoreutils 2.5-34.el7
[host21] tar 1.26-35.el7
[host21] libedit 3.0-12.20121213cvs.el7
[host21] sendmail 8.14.7-6.el7
[host21] newt 0.52.15-4.el7
[host21] libsmi 0.4.8-13.el7
[host21] jansson 2.10-1.el7
[host21] zsh 5.0.2-34.el7_8.2
[host21] ethtool 4.8-10.el7
[host21] ntp 4.2.6p5-29.el7_8.2
[host21] libSM 1.2.2-2.el7
[host21] perl-Pod-LaTeX 0.61-2.el7
[host21] usb_modeswitch-data 20170806-1.el7
[host21] perl-IO-stringy 2.110-22.el7
[host21] lgtoman 9.2.1.3-1
[host21] python-slip-dbus 0.4.0-4.el7
[host21] perl-File-CheckTree 4.42-3.el7
[host21] zabbix-sender 4.2.7-1.el7
[host21] python-hwdata 1.7.3-4.el7
[host21] perl-Text-Soundex 3.04-4.el7
[host21] gpg-pubkey fd431d51-4ae0493b
[host21] perl-Business-ISBN-Data 20120719.001-2.el7
[host21] libreport-rhel 2.1.11-53.el7
[host21] perl-autodie 2.16-2.el7
[host21] perl-File-Listing 6.04-7.el7
[host21] python-pyudev 0.15-9.el7
[host21] perl-DBI 1.627-4.el7
[host21] perl-Net-LibIDN 0.12-15.el7
[host21] less 458-9.el7
[host21] libestr 0.1.9-2.el7
[host21] libdb-devel 5.3.21-25.el7
[host21] mailcap 2.1.41-2.el7
[host21] bzip2 1.0.6-13.el7
[host21] perl-HTTP-Cookies 6.01-5.el7
[host21] perl-HTML-Format 2.10-7.el7
[host21] ncurses 5.9-14.20130511.el7_4
[host21] xdg-utils 1.1.0-0.17.20120809git.el7
[host21] snappy 1.1.0-3.el7
[host21] libverto 0.2.5-4.el7
[host21] perl-Git 1.8.3.1-23.el7_8
[host21] perl-ExtUtils-MakeMaker 6.68-3.el7
[host21] libseccomp 2.3.1-4.el7
[host21] expect 5.45-14.el7_1
[host21] perl-IPC-Cmd 0.80-4.el7
[host21] libfastjson 0.99.4-3.el7
[host21] pakchois 0.4-10.el7
[host21] perl-File-Fetch 0.42-2.el7
[host21] libsysfs 2.1.0-16.el7
[host21] numactl 2.0.12-5.el7
[host21] libtevent 0.9.39-1.el7
[host21] pm-utils 1.4.1-27.el7
[host21] samba-libs 4.10.16-18.el7_9
[host21] firewalld 0.6.3-13.el7_9
[host21] rsyslog 8.24.0-57.el7_9.1
[host21] strace 4.24-6.el7
[host21] systemtap-runtime 4.0-13.el7
[host21] openssl 1.0.2k-24.el7_9
[host21] bpftool 3.10.0-1160.59.1.el7
[host21] ssaducli 5.20-8.0
[host21] nettle 2.7.1-9.el7_9
[host21] unzip 6.0-24.el7_9
[host21] man-pages-overrides 7.9.0-1.el7
[host21] chkconfig 1.7.6-1.el7
[host21] file-libs 5.11-37.el7
[host21] ca-certificates 2021.2.50-72.el7_9
[host21] python-libs 2.7.5-90.el7
[host21] libmount 2.23.2-65.el7_9.1
[host21] libgomp 4.8.5-44.el7
[host21] bind-libs-lite 9.11.4-26.P2.el7_9.9
[host21] nss 3.67.0-4.el7_9
[host21] nss-tools 3.67.0-4.el7_9
[host21] gettext 0.19.8.1-3.el7_9
[host21] python-requests 2.6.0-10.el7
[host21] sos 3.9-5.el7_9.10
[host21] python-magic 5.11-37.el7
[host21] selinux-policy 3.13.1-268.el7_9.2
[host21] curl 7.29.0-59.el7_9.1
[host21] elfutils-libs 0.176-5.el7
[host21] dbus 1.10.24-15.el7
[host21] procps-ng 3.3.10-28.el7
[host21] abrt-addon-kerneloops 2.1.11-60.el7
[host21] samba-client-libs 4.10.16-18.el7_9
[host21] abrt-tui 2.1.11-60.el7
[host21] systemd-python 219-78.el7_9.5
[host21] plymouth-core-libs 0.8.9-0.34.20140113.el7
[host21] rpm-python 4.11.3-48.el7_9
[host21] device-mapper-persistent-data 0.8.5-3.el7_9.2
[host21] perl-Module-Loaded 0.08-299.el7_9
[host21] perl-IO-Zlib 1.10-299.el7_9
[host21] zlib-devel 1.2.7-19.el7_9
[host21] libsss_nss_idmap 1.16.5-10.el7_9.12
[host21] libsmartcols 2.23.2-65.el7_9.1
[host21] libstoragemgmt-python 1.8.1-2.el7_9
[host21] openssh 7.4p1-22.el7_9
[host21] grub2-tools-minimal 2.02-0.87.el7_9.7
[host21] kpartx 0.4.9-135.el7_9
[host21] grub2-pc 2.02-0.87.el7_9.7
[host21] dhclient 4.2.5-83.el7_9.1
[host21] abrt-cli 2.1.11-60.el7
[host21] perl-ExtUtils-Install 1.58-299.el7_9
[host21] vim-common 7.4.629-8.el7_9
[host21] kbd-legacy 1.15.5-16.el7_9
[host21] perl-core 5.16.3-299.el7_9
[host21] katello-host-tools 3.5.4-1.el7sat
[host21] openssh-clients 7.4p1-22.el7_9
[host21] teamd 1.29-3.el7
[host21] e2fsprogs 1.42.9-19.el7
[host21] python-six 1.9.0-2.el7
[host21] pinfo 0.6.10-9.el7
[host21] filesystem 3.2-25.el7
[host21] libreport-filesystem 2.1.11-53.el7
[host21] oprofile 0.9.9-27.el7
[host21] python-dmidecode 3.12.2-4.el7
[host21] fprintd-pam 0.8.1-2.el7
[host21] compat-db-headers 4.7.25-28.el7
[host21] pygobject2 2.28.6-11.el7
[host21] sfutils 7.1.3.1000-1
[host21] python-augeas 0.5.0-2.el7
[host21] mlocate 0.26-8.el7
[host21] libselinux 2.5-15.el7
[host21] audit 2.8.5-4.el7
[host21] dkms 2.8.3-2.el7
[host21] xz-libs 5.2.2-1.el7
[host21] grubby 8.28-26.el7
[host21] rsync 3.1.2-10.el7
[host21] ethaffinity 1.2.2-0017
[host21] popt 1.13-16.el7
[host21] smartmontools 7.0-2.el7
[host21] grep 2.20-3.el7
[host21] python-configobj 4.7.2-7.el7
[host21] crda 3.18_2018.05.31-4.el7
[host21] libcap 2.22-11.el7
[host21] pyxattr 0.5.1-5.el7
[host21] qualys-cloud-agent 2.6.0-115
[host21] libgpg-error 1.12-3.el7
[host21] python-kitchen 1.1.1-5.el7
[host21] cryptsetup 2.0.3-6.el7
[host21] SVCtools 1.03-1365
[host21] gawk 4.0.2-4.el7_3.1
[host21] pcre-devel 8.32-17.el7
[host21] python-slip 0.4.0-4.el7
[host21] gpg-pubkey 5ce2d476-50be41ba
[host21] sqlite 3.7.17-8.el7_7.1
[host21] libicu 50.2-4.el7_7
[host21] yum-langpacks 0.4.2-7.el7
[host21] bind-license 9.11.4-26.P2.el7_9.9
[host21] diffutils 3.3-5.el7
[host21] bzip2-devel 1.0.6-13.el7
[host21] xfsdump 3.1.7-1.el7
[host21] libX11-common 1.6.7-4.el7_9
[host21] xmlrpc-c 1.32.5-1905.svn2451.el7
[host21] tzdata 2021e-1.el7
[host21] groff-base 1.22.2-8.el7
[host21] redhat-logos 70.7.0-1.el7
[host21] perl-Crypt-SSLeay 0.64-5.el7
[host21] glibc 2.17-325.el7_9
[host21] perl-XML-Grove 0.46alpha-52.el7
[host21] libcom_err 1.42.9-19.el7
[host21] bc 1.06.95-13.el7
[host21] libxml2 2.9.1-6.el7_9.6
[host21] perl-podlators 2.5.1-3.el7
[host21] xmlrpc-c-client 1.32.5-1905.svn2451.el7
[host21] nano 2.3.1-10.el7
[host21] sed 4.2.2-7.el7
[host21] cpio 2.11-28.el7
[host21] perl-threads 1.87-4.el7
[host21] GeoIP 1.5.0-14.el7
[host21] rdate 1.4-25.el7
[host21] perl-Time-HiRes 1.9725-3.el7
[host21] python-urlgrabber 3.10-10.el7
[host21] setserial 2.17-33.el7
[host21] perl-Scalar-List-Utils 1.27-248.el7
[host21] libtirpc 0.2.4-0.16.el7
[host21] perl-PathTools 3.40-5.el7
[host21] libpipeline 1.2.3-3.el7
[host21] libsemanage 2.5-14.el7
[host21] perl-Module-Load 0.24-3.el7
[host21] libdaemon 0.14-7.el7
[host21] perl-ExtUtils-Manifest 1.61-244.el7
[host21] perl-Pod-Parser 1.61-2.el7
[host21] words 3.0-22.el7
[host21] perl-Digest-SHA 5.85-4.el7
[host21] perl-Parse-CPAN-Meta 1.4404-5.el7
[host21] satyr 0.13-15.el7
[host21] perl-Params-Check 0.38-2.el7
[host21] perl-Log-Message-Simple 0.10-2.el7
[host21] libXtst 1.2.3-1.el7
[host21] libcollection 0.7.0-32.el7
[host21] perl-HTML-Tagset 3.20-15.el7
[host21] libusbx 1.0.21-1.el7
[host21] libnfsidmap 0.25-19.el7
[host21] libassuan 2.1.0-3.el7
[host21] libunistring 0.9.3-9.el7
[host21] libreport-web 2.1.11-53.el7
[host21] procmail 3.22-36.el7_4.1
[host21] slang 2.2.4-11.el7
[host21] c-ares 1.10.0-3.el7
[host21] libnfnetlink 1.0.1-4.el7
[host21] lzo 2.06-8.el7
[host21] autogen-libopts 5.18-5.el7
[host21] libnetfilter_conntrack 1.0.6-1.el7_3
[host21] boost-thread 1.53.0-28.el7
[host21] libICE 1.0.9-9.el7
[host21] perl-Pod-Checker 1.60-2.el7
[host21] dmraid 1.0.0.rc16-28.el7
[host21] xorg-x11-xauth 1.0.9-1.el7
[host21] perl-Version-Requirements 0.101022-244.el7
[host21] usb_modeswitch 2.5.1-1.el7
[host21] lgtoclnt 9.2.1.3-1
[host21] perl-Sys-Syslog 0.33-3.el7
[host21] zabbix-agent 4.2.7-1.el7
[host21] perl-Text-Unidecode 0.04-20.el7
[host21] libpciaccess 0.14-1.el7
[host21] perl-IO-HTML 1.00-2.el7
[host21] perl-WWW-RobotRules 6.02-5.el7
[host21] ebtables 2.0.10-16.el7
[host21] perl-HTTP-Date 6.02-8.el7
[host21] perl-PlRPC 0.2020-14.el7
[host21] perl-Thread-Queue 3.02-2.el7
[host21] hunspell-en-GB 0.20121024-6.el7
[host21] tcp_wrappers 7.6-77.el7
[host21] attr 2.4.46-13.el7
[host21] pinentry 0.8.1-17.el7
[host21] perl-LWP-MediaTypes 6.02-2.el7
[host21] perl-HTTP-Negotiate 6.01-5.el7
[host21] perl-HTML-Tree 5.03-2.el7
[host21] libproxy 0.4.11-11.el7
[host21] gmp 6.0.0-15.el7
[host21] perl-TermReadKey 2.30-20.el7
[host21] libyaml 0.1.4-11.el7_0
[host21] tcl 8.5.13-8.el7
[host21] gpm-libs 1.20.7-6.el7
[host21] perl-Archive-Extract 0.68-3.el7
[host21] apr-util 1.5.2-6.el7
[host21] libpcap 1.5.3-12.el7
[host21] perl-CPANPLUS 0.91.38-4.el7
[host21] quota-nls 4.01-19.el7
[host21] libtalloc 2.1.16-1.el7
[host21] quota 4.01-19.el7
[host21] avahi-libs 0.6.31-20.el7
[host21] lshw B.02.18-17.el7
[host21] subversion 1.7.14-16.el7
[host21] ksh 20120801-143.el7_9
[host21] libgudev1 219-78.el7_9.5
[host21] bind-utils 9.11.4-26.P2.el7_9.9
[host21] cyrus-sasl-plain 2.1.26-24.el7_9
[host21] ntsysv 1.7.6-1.el7
[host21] ssacli 5.20-8.0
[host21] kernel-devel 3.10.0-1160.59.1.el7
[host21] psmisc 22.20-17.el7
[host21] hponcfg 5.6.0-0
[host21] libgcc 4.8.5-44.el7
[host21] openssl-libs 1.0.2k-24.el7_9
[host21] python 2.7.5-90.el7
[host21] glib2 2.56.1-9.el7_9
[host21] lz4 1.8.3-1.el7
[host21] apr 1.4.8-7.el7
[host21] iptables 1.4.21-35.el7
[host21] subversion-libs 1.7.14-16.el7
[host21] qpid-proton-c 0.28.0-4.el7
[host21] python-syspurpose 1.24.50-1.el7_9
[host21] pyldb 1.5.4-2.el7_9
[host21] systemtap-sdt-devel 4.0-13.el7
[host21] binutils 2.27-44.base.el7_9.1
[host21] rpm-libs 4.11.3-48.el7_9
[host21] systemd-libs 219-78.el7_9.5
[host21] elfutils-default-yama-scope 0.176-5.el7
[host21] abrt-dbus 2.1.11-60.el7
[host21] samba-common 4.10.16-18.el7_9
[host21] dhcp-libs 4.2.5-83.el7_9.1
[host21] abrt-addon-xorg 2.1.11-60.el7
[host21] abrt-addon-python 2.1.11-60.el7
[host21] elfutils 0.176-5.el7
[host21] subscription-manager-rhsm 1.24.50-1.el7_9
[host21] perl-Module-CoreList 2.76.02-299.el7_9
[host21] perl-Pod-Escapes 1.04-299.el7_9
[host21] perl-Object-Accessor 0.42-299.el7_9
[host21] libpng 1.5.13-8.el7
[host21] vim-minimal 7.4.629-8.el7_9
[host21] util-linux 2.23.2-65.el7_9.1
[host21] libstoragemgmt 1.8.1-2.el7_9
[host21] device-mapper-libs 1.02.170-6.el7_9.5
[host21] device-mapper-event 1.02.170-6.el7_9.5
[host21] dracut 033-572.el7
[host21] plymouth-scripts 0.8.9-0.34.20140113.el7
[host21] dracut-network 033-572.el7
[host21] kernel-tools-libs 3.10.0-1160.59.1.el7
[host21] perl-devel 5.16.3-299.el7_9
[host21] linux-firmware 20200421-80.git78c0348.el7_9
[host21] kbd 1.15.5-16.el7_9
[host21] gcc 4.8.5-44.el7
[host21] grub2 2.02-0.87.el7_9.7
[host21] openssh-server 7.4p1-22.el7_9
[host21] sssd-client 1.16.5-10.el7_9.12
[host21] redhat-support-tool 0.13.0-0.el7_9
[host21] Red_Hat_Enterprise_Linux-Release_Notes-7-en-US 7-2.el7
[host21] setup 2.8.71-11.el7
[host21] mdadm 4.1-9.el7_9
[host21] lftp 4.4.8-12.el7_8.1
[host21] gobject-introspection 1.56.1-1.el7
[host21] python-gofer-proton 2.12.5-7.el7sat
[host21] mpfr 3.1.1-4.el7
[host21] m2crypto 0.21.1-17.el7
[host21] mariadb-libs 5.5.68-1.el7
[host21] onload-dkms 7.1.0.265-0
[host21] augeas-libs 1.4.0-10.el7
[host21] rng-tools 6.3.1-5.el7
[host21] pyliblzma 0.5.3-11.el7
[host21] gdb-gdbserver 7.6.1-120.el7
[host21] ntpdate 4.2.6p5-29.el7_8.2
[host21] python2-futures 3.1.1-5.el7
[host21] patchutils 0.3.3-5.el7_9
[host21] libffi 3.0.13-19.el7
[host21] libgcc 4.8.5-44.el7
[host21] gcc-c++ 4.8.5-44.el7
[host21] lua 5.1.4-15.el7
[host21] kernel-headers 3.10.0-1160.59.1.el7
[host21] mailx 12.5-19.el7
[host21] nspr 4.32.0-1.el7_9
[host21] perl-XML-Dumper 0.81-17.el7
[host21] perl-HTTP-Tiny 0.033-3.el7
[host21] libstdc++ 4.8.5-44.el7
[host21] gpgme 1.3.2-5.el7
[host21] lsof 4.87-6.el7
[host21] file 5.11-37.el7
[host21] bridge-utils 1.5-9.el7
[host21] perl-threads-shared 1.43-6.el7
[host21] cyrus-sasl-lib 2.1.26-24.el7_9
[host21] perl-Mozilla-CA 20130114-5.el7
[host21] rootfiles 8.1-11.el7
[host21] perl-Getopt-Long 2.40-3.el7
[host21] libcroco 0.6.12-6.el7_9
[host21] shadow-utils 4.6-5.el7
[host21] perl-Module-Metadata 1.000018-2.el7
[host21] iproute 4.11.0-30.el7
[host21] redhat-indexhtml 7-13.el7
[host21] perl-Module-Pluggable 4.8-3.el7
[host21] python-qpid-proton 0.28.0-4.el7
[host21] getldp 0.1.7-1.el7
[host21] python-perf 3.10.0-1160.59.1.el7
[host21] polkit-pkla-compat 0.1-4.el7
[host21] libXi 1.7.9-1.el7
[host21] perl-IO-Compress 2.061-2.el7
[host21] libssh2 1.8.0-4.el7
[host21] crontabs 1.11-6.20121102git.el7
[host21] keyutils 1.5.8-3.el7
[host21] p11-kit 0.23.5-3.el7
[host21] dbus-libs 1.10.24-15.el7
[host21] hesiod 3.2.1-3.el7
[host21] libnl 1.1.4-3.el7
[host21] abrt 2.1.11-60.el7
[host21] gnutls 3.3.29-9.el7_6
[host21] yajl 2.0.4-4.el7
[host21] dhcp-common 4.2.5-83.el7_9.1
[host21] ilorest 2.5.0-22
[host21] iw 4.3-2.el7
[host21] cronie-anacron 1.4.11-24.el7_9
[host21] libXmu 1.1.2-2.el7
[host21] perl-Test-Simple 0.98-243.el7
[host21] yum 3.4.3-168.el7
[host21] libfprint 0.8.2-1.el7
[host21] puppet-agent 5.5.20-1.el7
[host21] perl-CGI 3.63-4.el7
[host21] perl-Package-Constants 0.02-299.el7_9
[host21] libdrm 2.4.97-2.el7
[host21] perl-URI 1.60-9.el7
[host21] freetype 2.8-14.el7_9.1
[host21] perl-Net-Daemon 0.48-5.el7
[host21] initscripts 9.49.53-1.el7_9.1
[host21] python-gudev 147.2-7.el7
[host21] ipset 7.1-1.el7
[host21] device-mapper 1.02.170-6.el7_9.5
[host21] grub2-tools 2.02-0.87.el7_9.7
[host21] make 3.82-24.el7
[host21] kexec-tools 2.0.15-51.el7_9.3
[host21] perl-HTTP-Daemon 6.01-8.el7
[host21] libmodman 2.0.1-8.el7
[host21] perl-ExtUtils-Embed 1.30-299.el7_9
[host21] perl-Error 0.17020-2.el7
[host21] pth 2.0.7-23.el7
[host21] vdo 6.1.3.23-5.el7
[host21] numactl-libs 2.0.12-5.el7
[host21] dracut-config-rescue 033-572.el7
[host21] perl-CPANPLUS-Dist-Build 0.70-3.el7
[host21] sudo 1.8.23-10.el7_9.2
[host21] pytalloc 2.1.16-1.el7
[host21] autofs 5.0.7-116.el7_9
[host21] python-dateutil 1.5-7.el7
[host21] amsd 2.5.0-1675.24.rhel7
[host21] openssl098e 0.9.8e-29.el7_2.3
[host21] wireshark 1.10.14-25.el7
[host21] libpwquality 1.2.3-5.el7
[host21] setuptool 1.19.11-8.el7
[host21] libsepol 2.5-10.el7
[host21] hunspell 1.3.2-16.el7
[host21] libreport-plugin-mailx 2.1.11-53.el7
[host21] telnet 0.17-66.el7
[host21] readline 6.2-11.el7
[host21] hwloc-libs 1.11.8-4.el7
[host21] nss-softokn-freebl 3.67.0-3.el7_9
[host21] PyYAML 3.10-11.el7
[host21] ledmon 0.92-1.el7
[host21] libcap-ng 0.7.5-4.el7
[host21] gpg-pubkey 26c2b797-5669d0b9
[host21] wireshark-devel 1.10.14-25.el7
[host21] python-backports-ssl_match_hostname 3.5.0.1-1.el7
[host21] man-db 2.6.3-11.el7
[host21] which 2.20-7.el7
[host21] kbd-misc 1.15.5-16.el7_9
[host21] nss-pem 1.0.3-7.el7
[host21] bash-completion 2.1-8.el7
[host21] gdbm 1.10-8.el7
[host21] nss-softokn-freebl 3.67.0-3.el7_9
[host21] fipscheck 1.4.1-6.el7
[host21] iprutils 2.4.17.1-3.el7_7
[host21] perl-libs 5.16.3-299.el7_9
[host21] libuser 0.60-9.el7
[host21] perl-Text-ParseWords 3.29-4.el7
[host21] expat 2.1.0-12.el7
[host21] passwd 0.79-6.el7
[host21] traceroute 2.0.22-2.el7
[host21] perl-Filter 1.49-3.el7
[host21] krb5-libs 1.15.1-51.el7_9
[host21] perl-File-Temp 0.23.01-3.el7
[host21] cups-libs 1.6.3-51.el7
[host21] hardlink 1.0-19.el7
[host21] perl-version 0.99.07-6.el7
[host21] nss-sysinit 3.67.0-4.el7_9
[host21] perl-Perl-OSType 1.003-3.el7
[host21] gettext-libs 0.19.8.1-3.el7_9
[host21] perl-CPAN-Meta-Requirements 2.122-7.el7
[host21] libxml2-python 2.9.1-6.el7_9.6
[host21] libreport-python 2.1.11-53.el7
[host21] libxcb 1.13-1.el7
[host21] perl-Log-Message 0.08-3.el7
[host21] bind-export-libs 9.11.4-26.P2.el7_9.9
[host21] libbasicobjects 0.1.1-32.el7
[host21] perl-IO-Socket-IP 0.21-5.el7
[host21] openldap 2.4.44-25.el7_9
[host21] usermode 1.111-6.el7
[host21] libini_config 1.3.1-32.el7
[host21] kmod-libs 20-28.el7
[host21] systemd-sysv 219-78.el7_9.5
[host21] os-prober 1.58-9.el7
[host21] hostname 3.13-3.el7_7.1
[host21] libwbclient 4.10.16-18.el7_9
[host21] iptraf-ng 1.1.4-7.el7
[host21] keyutils-libs 1.5.8-3.el7
[host21] gssproxy 0.7.0-30.el7_9
[host21] perl-Archive-Tar 1.92-3.el7
[host21] rpm-build-libs 4.11.3-48.el7_9
[host21] xinetd 2.3.15-14.el7
[host21] perl-CPAN 1.9800-299.el7_9
[host21] perl-Locale-Codes 3.26-2.el7
[host21] e2fsprogs-libs 1.42.9-19.el7
[host21] perl-DB_File 1.830-6.el7
[host21] libteam 1.29-3.el7
[host21] perl-DBIx-Simple 1.35-7.el7
[host21] subscription-manager 1.24.50-1.el7_9
[host21] lvm2 2.02.187-6.el7_9.5
[host21] lm_sensors-libs 3.4.0-8.20160601gitf9185e5.el7
[host21] libdb-utils 5.3.21-25.el7
[host21] katello-host-tools-fact-plugin 3.5.4-1.el7sat
[host21] perl-HTML-Parser 3.71-4.el7
[host21] libselinux-utils 2.5-15.el7
[host21] glibc-devel 2.17-325.el7_9
[host21] desktop-file-utils 0.23-2.el7
[host21] boost-date-time 1.53.0-28.el7
[host21] kmod-kvdo 6.1.3.23-5.el7
[host21] git 1.8.3.1-23.el7_8
[host21] libndp 1.2-9.el7
[host21] abrt-console-notification 2.1.11-60.el7
[host21] perl-Module-Build 0.40.05-2.el7
[host21] neon 0.30.0-4.el7
[host21] libtasn1 4.10-1.el7
[host21] cyrus-sasl 2.1.26-24.el7_9
[host21] libtdb 1.3.18-1.el7
    [pyinfra.connectors.ssh] Waiting for exit status...
    [pyinfra.connectors.ssh] Command exit status: 0
    [host21] Loaded fact rpm.RpmPackages
    [pyinfra.api.facts] Getting fact: rpm.RpmPackageProvides (name=gcc-c++) (ensure_hosts: None)
    [pyinfra.connectors.ssh] Running command on host21: (pty=None) sudo -H -n sh -c '! command -v repoquery >/dev/null || repoquery --queryformat "%{NAME} %{VERSION}-%{RELEASE}\n" --whatprovides gcc-c++ || true'
[host21] >>> sudo -H -n sh -c '! command -v repoquery >/dev/null || repoquery --queryformat "%{NAME} %{VERSION}-%{RELEASE}\n" --whatprovides gcc-c++ || true'
[host21] gcc-c++ 4.8.3-9.el7
[host21]
[host21] gcc-c++ 4.8.5-16.el7_4.2
[host21]
[host21] gcc-c++ 4.8.5-28.el7_5.1
[host21]
[host21] gcc-c++ 4.8.5-44.el7
[host21]
[host21] gcc-c++ 4.8.5-36.el7_6.1
[host21]
[host21] gcc-c++ 4.8.5-36.el7
[host21]
[host21] gcc-c++ 4.8.5-36.el7_6.2
[host21]
[host21] gcc-c++ 4.8.5-11.el7
[host21]
[host21] gcc-c++ 4.8.2-16.2.el7_0
[host21]
[host21] gcc-c++ 4.8.5-16.el7
[host21]
[host21] gcc-c++ 4.8.2-16.el7
[host21]
[host21] gcc-c++ 4.8.5-4.el7
[host21]
[host21] gcc-c++ 4.8.5-39.el7
[host21]
[host21] gcc-c++ 4.8.5-16.el7_4.1
[host21]
[host21] gcc-c++ 4.8.5-28.el7
[host21]
    [pyinfra.connectors.ssh] Waiting for exit status...
    [pyinfra.connectors.ssh] Command exit status: 0
    [host21] Loaded fact rpm.RpmPackageProvides (name=gcc-c++)
Fizzadar commented 2 years ago

This appears to happen when there's multiple installed versions of a package already which then lists them all under repoquery --whatprovides which gets expanded into a list of (package, [version]) tuples. What should happen (I think) is we end up with (package, [version1, version2, ...]).

Fizzadar commented 2 years ago

This should finally be fixed as of v2.4 (https://github.com/Fizzadar/pyinfra/commit/27188a445db583dc0bf785102410506de3e64a64) if you wouldn't mind testing this to confirm @julienlavergne.