pip.installed: upgrade: true always makes changes #67682
Replies: 16 comments
-
@nicholascapo, do you still have this error on 2015.5.0 or later? |
Beta Was this translation helpful? Give feedback.
-
Yes $ salt --versions-report
Salt: 2015.5.0
Python: 2.7.3 (default, Mar 13 2014, 11:03:55)
Jinja2: 2.6
M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.6
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 13.1.0
RAET: Not Installed
ZMQ: 3.2.3
Mako: 0.7.0
Debian source package: 2015.5.0+ds-1~bpo70+1 ---
python-pip:
pkg.latest
sh:
pip.installed:
- upgrade: true
- require:
- pkg: python-pip
The output from subsequent runs is the same: $ sudo salt-call --retcode-passthrough state.sls python
[...]
[INFO ] Package python-pip is already up-to-date.
[INFO ] Completed state [python-pip] at time 22:35:23.447469
[INFO ] Running state [sh] at time 22:35:23.486890
[INFO ] Executing state pip.installed for sh
[INFO ] Executing command '/usr/bin/pip freeze' in directory '/root'
[INFO ] Executing command "/usr/bin/pip install --upgrade 'sh'" in directory '/root'
[INFO ] Executing command '/usr/bin/pip freeze' in directory '/root'
[INFO ] {'sh==1.11': 'Installed'}
[INFO ] Completed state [sh] at time 22:35:24.455039
local:
----------
ID: sh
Function: pip.installed
Result: True
Comment: All packages were successfully installed
Started: 22:35:23.486890
Duration: 968.149 ms
Changes:
----------
sh==1.11:
Installed
Summary
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
|
Beta Was this translation helpful? Give feedback.
-
@jfindlay Looking at it again, This seems like (partially) reasonable behavior. It really just runs I would be satisfied with a new If you like, you are welcome to change this into a feature request for |
Beta Was this translation helpful? Give feedback.
-
@nicholascapo, that sounds fine to me, thanks. |
Beta Was this translation helpful? Give feedback.
-
+1 for the feature request. I need to keep pip up to date and pip.latest would be just the ticket. |
Beta Was this translation helpful? Give feedback.
-
+1 for pip.latest. |
Beta Was this translation helpful? Give feedback.
-
pip.latest +1 |
Beta Was this translation helpful? Give feedback.
-
I'm seeing this too. I don't believe the behaviour is reasonable though. If nothing changed, it shouldn't report a change. Or is there actually something changing that is not made clear? Thanks! |
Beta Was this translation helpful? Give feedback.
-
@driskell This could potentially upgrade the dependencies of the package that you are wanting to install by upgrading them. IIRC there was a note on the Pypi/pip readthedocs about the somewhat crazy way to upgrade a single package which is to update other packages first with a no depends and then update the package you actually wanted to update. I'm not sure how Salt passes it through to pip, but I know doing a pip -U install somethign will also get somethingelse that was depended on at its latest version. |
Beta Was this translation helpful? Give feedback.
-
@dragon788 Yes not ideal, though I think that is more a pip problem than a salt state problem. The issue I have here is even if nothing is changed by the upgrade, salt state reports a bogus change. I remember something about a pip bug causing upgrade to always reinstall (which would be a change). But it's not clear from the salt state output that anything was changed and this is bound to be fixed eventually in pip if not already. So salt state should either report no change or report what was changed. Otherwise the status is meaningless and confusing :( |
Beta Was this translation helpful? Give feedback.
-
Has there been any movement or workarounds on this? |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Beta Was this translation helpful? Give feedback.
-
This is still an annoyance! |
Beta Was this translation helpful? Give feedback.
-
Thank you for updating this issue. It is no longer marked as stale. |
Beta Was this translation helpful? Give feedback.
-
@saltstack/team-triage FYI |
Beta Was this translation helpful? Give feedback.
-
Wow, I am quite surprised to see this bug has existed for so long. When you look at the code, it's kind of obvious why: Line 1165 in fc65161 It simply invokes a shell command to run pip, and doesn't have any logic to determine whether anything actually changed on the system as a result. To my surprise, I learned that pip purposely does not have a public library API, so shelling out is the only choice. I was curious what other CMSs do, so I looked at how Ansible handles this: Looks like what they do is:
And compare the output of 1 and 3. A similar approach could be taken. |
Beta Was this translation helpful? Give feedback.
-
I want to keep the latest version of a pip package installed, but every time I run highstate it reports changes.
Expected:
pip.installed
withupgrade: True
would work likepkg.latest
, doing a check, and then not making a change unless there is an update available.Got:
State run returns changes every time.
Example state
Example run:
Beta Was this translation helpful? Give feedback.
All reactions