Skip to content

pkg - parameter "allow_updates" not working as expected #35385

Closed

Description

@DaveOHenry

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

  1. changed the title [-]pkg - parameter "allow_updates" does not work when used with "sources"[/-] [+]pkg - parameter "allow_updates" not working as expected[/+] on Aug 12, 2016
  2. Ch3LL commented on Aug 12, 2016

    @Ch3LL
    Contributor

    @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.

  3. added
    Duplicate
    on Aug 12, 2016
  4. added this to the Blocked milestone on Aug 12, 2016
  5. DaveOHenry commented on Aug 12, 2016

    @DaveOHenry
    Author

    I don't know if it matters, but in my case there is no repository involved. The package is installed from a source file:

    myuser@saltmaster:/srv/salt/check_mk_agent# salt 'myminion' state.apply check_mk_agent
    myminion:
    ----------
              ID: install_xinetd
        Function: pkg.installed
          Result: True
         Comment: All specified packages are already installed
         Started: 19:53:16.152294
        Duration: 266.358 ms
         Changes:   
    ----------
              ID: install_agent
        Function: pkg.installed
          Result: True
         Comment: The following packages were installed/updated: check-mk-agent
         Started: 19:53:16.418898
        Duration: 3679.437 ms
         Changes:   
                  ----------
                  check-mk-agent:
                      ----------
                      new:
                          1.2.8-d7d623e571644be0
                      old:
                          1.2.8-dffa5c87b48cd50c
    ----------
    ...
    

    If the fix for #32535 includes disabling version checks when "allow_updates" is set everything should work in my case, too.

  6. Ch3LL commented on Aug 15, 2016

    @Ch3LL
    Contributor

    @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.

  7. added
    bug
    severity-medium
    P4
    Platform
    and removed
    Duplicate
    on Aug 15, 2016
  8. modified the milestones: Approved, Blocked on Aug 15, 2016
  9. stale commented on Jun 16, 2018

    @stale

    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.

  10. 20 remaining items

  11. mochrul commented on May 16, 2021

    @mochrul

    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.

  12. modified the milestones: Approved, Argon v3008 on Aug 30, 2023
  13. modified the milestones: Argon v3008, Approved on Sep 6, 2023
  14. added
    help-wanted
    pending-community-assignment
    on Sep 6, 2023
  15. added a commit that references this issue on Aug 7, 2026
    0cbe138
  16. added a commit that references this issue on Oct 27, 2026
    4c14357
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PlatformState-Modulebughelp-wantedpending-community-assignmentseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions