Version support for "sources" arg in pkg.installed states
Example config:
erlang:
pkg.installed:
- sources:
- esl-erlang: salt://files/packages/esl-erlangR15B02.deb
If I were to change the above config to use a deb with the version R16B02, salt does not upgrade the package because esl-erlang is already installed, and pkg.latest does not work with a "sources" parameter.
Thanks for pointing this out. We'll get this fixed.
Ah, I just got bitten by the same thing on CentOS. Therefore, bump ;)
I too am running into this on CentOS! Working around it as we speak.
I've run into the same problem. Any workaround?
+1
Presently, the only solution would be to uninstall the package and reinstall the new one. This will require a modification to Salt's package management API and is a non-trivial change. It's definitely on my list of things to do, it just might take a few weeks to get to it.
@galet here is my workaround:
{%- set influxdb_version = '0.5.0-rc.3' %}
# workaround issue #7772
{%- if salt['cmd.run']("dpkg-query --showformat='${Version}' -W influxdb") != influxdb_version %}
influxdb-pkg-removed:
pkg.removed:
- name: influxdb
- require_in:
- pkg: influxdb
{%- endif %}
influxdb:
pkg.installed:
- sources:
- influxdb: http://s3.amazonaws.com/influxdb/influxdb_{{ influxdb_version }}_{{ grains['osarch'] }}.deb
This will uninstall the influxdb pkg if influxdb_version is different from version of influxdb pkg currently installed.
Ran into this with my first ever .sls file https://gist.github.com/jsuchal/e63c85b4ca0a2eb9a939 and here is a workaround. https://gist.github.com/jsuchal/da156a97fa4cf7c4d856
I just ran into this same issue.
It seems that a solution would be to treat sources similar names/pkgs how you can specify a version would work.
Syntax like this for example:
libzmq3:
pkg.installed:
- sources:
- libzmq3:
source: salt://libzmq3-3.2.2-13.1.x86_64.rpm
version: 3.2.2-13.1
With the old syntax retaining the current behaviour.
I'm not too familiar with the pkg state, but it seems to me like this could be achieved by editing https://github.com/saltstack/salt/blob/develop/salt/states/pkg.py#L185 and replacing the
targets = [x for x in desired if x not in cur_pkgs]
With something like
targets = [x for x in desired if (x is not dict and x not in cur_pkgs) or (x is dict and (x['source'] not in cur_pkgs or x['version'] in cur_pkgs[x['source']]))]
Kinda ugly looking, and would need fixups elsewhere to handle using x['source'] instead of x in other places, etc but is there any reason this sort of approach wouldn't work?
@nvx I've already worked out a strategy for implementing this, and know exactly how it is going to be done. It's just a matter of finding the cycles to do it.
+1
Is this fixed in the upcoming release?
No. This issue will be updated when it is, so just make sure you are subscribed to notifications for this issue and you will know once it has been fixed.
I have begun work on implementing this.
ZD-234
Is this being worked on at all? It's been an open bug for 3 releases now :(
This fix will not be part of 2015.2.0 . This fix is currently targeted for 2015.2.1 .
2015.2.0 is targeted to release very soon. 2015.2.1 will follow.
I had to put this aside a few months ago but I'm back working on it now.
Thanks dude, I'm still working around this almost 2 years later, but it's all good! :)
Yum support for this issue is being added in #23915 (still needs a rebase and some lint fixes). The way this is being implemented is that RPM metadata is checked and if it does not match what is installed, the package will be upgraded/downgraded accordingly.
For an example, see this gist.
Will apt also be targeted for 2015.5.2? This is actually a blocker now for my upgrade to 2015.5 since module.run now causes watches to be fired every run (which is causing restarts of services).