voxpupuli / puppet-python

Puppet module for installing and managing Python, pip, virtualenvs and Gunicorn virtual hosts.
https://forge.puppetlabs.com/puppet/python
Apache License 2.0
199 stars 370 forks source link

puppet tries to install latest version of a pip package on every run #638

Closed saz closed 1 year ago

saz commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

ensure_resource('python::pip', 'check-systemd', {'ensure' => 'latest', 'pip_provider' => 'pip3'})

What are you seeing

Puppet tries to install the package on each run

What behaviour did you expect instead

Puppet tries to install the package only once

Output log

Notice: /Stage[main]/Profile::Base::Common/Python::Pip[check-systemd]/Exec[pip_install_check-systemd]/returns: executed successfully (corrective)

Any additional information you'd like to impart

pip changed the dependency resolver in version 20.3. There's more information here: https://stackoverflow.com/a/26664162 As the command to find the latest version is returning an error instead of version numbers, there is no latest version available and that's why puppet tries to install the package on each run

Looks like as if we need to use a different command, depending on the pip version.

pip 20.3.4:

root@machine ~ # pip install --use-deprecated=legacy-resolver check-systemd==
ERROR: Could not find a version that satisfies the requirement check-systemd== (from versions: 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.3.1)
ERROR: No matching distribution found for check-systemd==

pip 20.0.2:

root@machine:~# pip install check-systemd==
ERROR: Could not find a version that satisfies the requirement check-systemd== (from versions: 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.3.1)
ERROR: No matching distribution found for check-systemd==

pip 20.1.1:

root@machine:~# pip install check-systemd==
ERROR: Could not find a version that satisfies the requirement check-systemd== (from versions: 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.3.1)
ERROR: No matching distribution found for check-systemd==

pip 19.1.1:

root@machine:~# pip install check-systemd==
Collecting check-systemd==
  ERROR: Could not find a version that satisfies the requirement check-systemd== (from versions: 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.3.1)
ERROR: No matching distribution found for check-systemd==

pip 22.0.4:

root@machine:~# pip install check-systemd==
ERROR: Could not find a version that satisfies the requirement check-systemd== (from versions: 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.3.1)
ERROR: No matching distribution found for check-systemd==