Repository navigation
Description
We have a monitoring system in place that manages its own client packages. The monitoring clients automatically update when certain settings on the monitoring server are changed. The process is as follows:
- The server creates a base package that has all settings needed for the monitoring client to function correctly
- We install this base client on the machines via Saltstack and from there on it maintains itself, meaning that it automatically updates to the appropriate version with the needed settings
- But when a highstate is now executed again the minion on our Linux boxes always installs the base client
- Afterwards the monitoring agent updates itself to the correct version and the loop begins again after the next highstate
The basic problem is that that the salt-minions on our Linux boxes always update / downgrade the monitoring agents even though "allow_updates" is set to "True". Maybe I misunderstood the function of "allow_updates", but I would expect that the minion ignores any version checks if the package itself is already installed.
On our Windows boxes everything works fine even without the magic Jinja workaround you can see below, but I think this has to do with the versions that the different packages report. The version numbers of the monitoring clients reported by pkg.version are:
for Linux something like
1.2.8-dffa6d98b48ca40c
1.2.8-d8db45ff22051fe8
1.2.8-31e4f294663a6f26
...
for Windows
1.2.8.12345
SLS file (with our current workaround)
{% from "vars.jinja" import vars with context %}
{% if grains['os'] == 'Ubuntu' %}
{% set packagename = 'check-mk-agent' %}
{% set filename = 'check-mk-agent.deb' %}
install_xinetd:
pkg.installed:
- pkgs:
- xinetd
{% elif grains['os'] == 'Windows' %}
refresh_db:
module.run:
- name: pkg.refresh_db
{% set packagename = 'check_mk-agent-msi' %}
{% set filename = 'check-mk-agent.msi' %}
{% endif %}
{% if not salt['pkg.version'](packagename) %}
install_agent:
pkg.installed:
- sources:
- {{ packagename }}: salt://{{ vars.cmk_server }}/agents/{{ filename }}
- allow_updates: True
- pkg_verify: False
- ignore_epoch: True
notify_master:
event.send:
- name: 'customevents/check_mk_agent/{{ grains['id'] }}/installed'
- with_grains: ['ip','kernel']
- onchanges:
- pkg: install_agent
{% endif %}
Versions Report
Salt Version:
Salt: 2016.3.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.5.1
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.4.0
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.4
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.19.0-25-generic
system: Linux
version: Ubuntu 14.04 trusty
Activity
[-]pkg - parameter "allow_updates" does not work when used with "sources"[/-][+]pkg - parameter "allow_updates" not working as expected[/+]Ch3LL commentedon Aug 12, 2016
@DaveOHenry looks like this is a duplicate of #32535 but in your instance you are also affected on linux. I'll remove the Windows label since this also affects linux VMs. If you agree this is a duplicate as well please close this issue and we will track this issue at 32535.
DaveOHenry commentedon Aug 12, 2016
I don't know if it matters, but in my case there is no repository involved. The package is installed from a source file:
If the fix for #32535 includes disabling version checks when "allow_updates" is set everything should work in my case, too.
Ch3LL commentedon Aug 15, 2016
@DaveOHenry good point that could be a big difference between the two issues so I will keep this one open and the two issues are now tied together for reference in the future. We can continue to track this issue here then, but the two might be the same depending on what the resolution is for the two issues. It seems allow_updates does not work in either situation.
stale commentedon Jun 16, 2018
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.
20 remaining items
mochrul commentedon May 16, 2021
I'm experiencing this issue too. The actual problem is in salt/states/pkg.py within the function _find_install_targets (currently at line 825) which looks like this:
allow_updates = bool(not sources and kwargs.get("allow_updates"))
And this practically means that if the sources is provided then the allow_updates option is ignored. If checked the history of the file and it was in this state since the allow_updates option is created (commit fef65b6)
The fix is easy but I do not know if it is allowed or this is actually the expected behavior and changing will brake something.
Honour allow_updates for pkg.installed sources installs
Honour allow_updates for pkg.installed sources installs