saltstack / saltstack/salt

onchanges acts like onchanges_any

Open
#56,133 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

salt-enhance
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

onchanges acts like onchanges_any should

Setup

Normal salt installation. 1 master, 1 minion

Steps to Reproduce Issue

Create orch file

install_jq:
  pkg.installed:
    - name: jq

install_tmux:
  pkg.installed:
    - name: tmux
    - require:
      - install_jq

install_htop:
  pkg.installed:
    - name: htop
    - require:
      - install_tmux

execute_runner:
  salt.runner:
    - name: config.get
    - key: file_roots
    - onchanges:
      - install_jq
      - install_tmux
      - install_htop

Yet execute_runner is executed with only install_jq having changes

root@ubuntu-test-1:/srv/salt# salt-run state.orch orch.install
ubuntu-test-1_master:
----------
          ID: install_jq
    Function: pkg.installed
        Name: jq
      Result: True
     Comment: The following packages were installed/updated: jq
     Started: 22:20:30.609458
    Duration: 10469.665 ms
     Changes:
              ----------
              jq:
                  ----------
                  new:
                      1.5+dfsg-2
                  old:
              libjq1:
                  ----------
                  new:
                      1.5+dfsg-2
                  old:
              libonig4:
                  ----------
                  new:
                      6.7.0-1
                  old:
----------
          ID: install_tmux
    Function: pkg.installed
        Name: tmux
      Result: True
     Comment: All specified packages are already installed
     Started: 22:20:41.090867
    Duration: 1164.657 ms
     Changes:
----------
          ID: install_htop
    Function: pkg.installed
        Name: htop
      Result: True
     Comment: All specified packages are already installed
     Started: 22:20:42.256054
    Duration: 9.206 ms
     Changes:
----------
          ID: execute_runner
    Function: salt.runner
        Name: config.get
      Result: True
     Comment: Runner function 'config.get' executed.
     Started: 22:20:42.268726
    Duration: 399.839 ms
     Changes:
              ----------
              return:
                  ----------
                  base:
                      - /srv/salt
                      - /srv/spm/salt

Summary for ubuntu-test-1_master
------------
Succeeded: 4 (changed=2)
Failed:    0
------------
Total states run:     4
Total run time:  12.043 s
Versions Report
root@ubuntu-test-1:/srv/salt# salt --versions-report
Salt Version:
           Salt: 3000

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
         Jinja2: 2.10
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.7
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.17 (default, Nov  7 2019, 10:07:09)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 16.0.2
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 4.15.0-66-generic
         system: Linux
        version: Ubuntu 18.04 bionic

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the orch.install example with the listed install_jq, install_tmux, install_htop, and execute_runner states using salt-run state.orch. Trace how onchanges evaluates multiple requisites compared with onchanges_any. Done means execute_runner follows onchanges semantics rather than running when only install_jq reports changes, with coverage for the demonstrated case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.