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 375 forks source link

`python::pip` doesn't reinstall if `extras` is updated (with no change in `ensure`) #630

Open EBoisseauSierra opened 2 years ago

EBoisseauSierra commented 2 years ago

Affected Puppet, Ruby, OS and module versions/distributions

Problem

I can install a Python package with an arbitrary list of optional dependencies (extras) and it works just fine on a blank VM. However, if I change the list of optional dependencies and run the agent again, the new dependencies are not installed.

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

What are you seeing

# install 'apache-superset[postgres, prophet]==1.3.2'
$ puppet agent

# (we effectively waited a few days — hence the dependencies update, see below)
# update dependencies to 'apache-superset[postgres, prophet, mysql]==1.3.2'
$ puppet agent

# manually install the package
$ pip freeze > /tmp/pip_deps_old.txt
$ pip install --upgrade --force-reinstall 'apache-superset[prophet, mysql, postgresql]'==1.3.2
$ pip freeze > /tmp/pip_deps_new.txt
$ diff /tmp/pip_deps_old.txt /tmp/pip_deps_new.txt
[…]
85c87
< msgpack==1.0.2
---
> msgpack==1.0.3
86a89
> mysqlclient==1.4.2.post1
89c92
< packaging==21.2
---
> packaging==21.3
[…]

We can see that some dependencies have been updated with more recent ones (e.g. msgpack and packaging, as the Agent hadn't run for a few days)… but more importantly, mysqlclient — required by the mysql extra dependency — is a new installed. This means that the Agent hadn't installed it.

What behaviour did you expect instead

The agent should --force-reinstall the package if the list of extra dependencies changes — even if ensure => M.m.p hasn't changed.

Any additional information you'd like to impart

In our real-life case, apache-superset has been installed via this part of our home-baked manifest.