saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
13.98k stars 5.47k forks source link

[BUG] In sls with multiple pkg.installed states the first one is always skipped #66631

Open davisj opened 2 weeks ago

davisj commented 2 weeks ago

Description In sls files with multiple pks.installed states the first one is always dropped (not installed)

Setup salt master and minion are both v3007.1 running on RedHat Enterprise 8 (x86_64) Using salt packages from https://repo.saltproject.io/salt/py3/redhat/8/x86_64/3007

saltmaster# rpm -qa|grep salt
salt-master-3007.1-0.x86_64
salt-minion-3007.1-0.x86_64
salt-3007.1-0.x86_64
salt-ssh-3007.1-0.x86_64

Steps to Reproduce the behavior Given the following SLS file:

A: pkg.installed
B: pkg.installed
C: pkg.installed

B and C will be installed but A will not.

And given this sls:

C: pkg.installed
A: pkg.installed
B: pkg.installed

A and B will install but C will not.

For example, given the following mytest.sls:

RdRand: pkg.installed
BibTool: pkg.installed
GeoIP-GeoLite-data: pkg.installed

I see this output from state.apply mytest

local:
----------
          ID: BibTool
    Function: pkg.installed
      Result: True
     Comment: 2 targeted packages were installed/updated.
     Started: 14:27:15.498966
    Duration: 11629.944 ms
     Changes:   
              ----------
              GeoIP-GeoLite-data:
                  ----------
                  new:
                      2018.06-5.el8
                  old:
              RdRand:
                  ----------
                  new:
                      2.1.2-2.el8
                  old:

Summary for local
------------
Succeeded: 3 (changed=1)
Failed:    0
------------
Total states run:     3
Total run time:  12.011 s

But BibTool is not installed. If I reorder so that RdRand appears first then RdRand will not be installed but BibTool will be installed. I've tried numerous combinations of package names (these EPEL packages were chosen somewhat at random) to rule out problems with specific packages and the result is always the same. Using the longer form for the state definitions also makes no difference.

i.e. This sls will produce the same result:

inst_rdrand:
  pkg.installed:
    - name: RdRand

inst_BibTool:
  pkg.installed:
    - name: BibTool

inst_GeoIP-GeoLite-data:
  pkg.installed:
    - name: GeoIP-GeoLite-data

Expected behavior I expect that an SLS with multiple pkg.installed states will result in all named packages getting installed.

Versions Report

salt --versions-report

Salt Version:
          Salt: 3007.1

Python Version:
        Python: 3.10.14 (main, Apr  3 2024, 21:30:09) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.1
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.5.2
        PyYAML: 6.0.1
         PyZMQ: 25.1.2
        relenv: 0.16.0
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.3.3
           ZMQ: 4.3.4

Salt Package Information:
  Package Type: onedir

System Versions:
          dist: rhel 8.10 Ootpa
        locale: utf-8
       machine: x86_64
       release: 4.18.0-553.el8_10.x86_64
        system: Linux
       version: Red Hat Enterprise Linux 8.10 Ootpa

Thank you very much for your time and attention.

davisj commented 2 weeks ago

I should also note that I first remember encountering this behavior after upgrading from 3005.x to 3006.x. I cannot say for sure whether it was present in versions prior to 3006. The issue remains in 3007.1