saltstack / saltstack/salt

[BUG] macpackage.installed installs pkg even in `test=True` mode

Open
#68,063 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
Whenever I run state.apply test=True, it seems that macpackage.installed still installs a .pkg file if version_check indicates the version was changed.

Setup
E.g. the state I'm using to install homebrew:

  macpackage.installed:
    - version_check: git -C /opt/homebrew describe --tags=4\.5\.4
    - require:
      - file: homebrew.pkg

Steps to Reproduce the behavior
Run salt --state-output=changes 'target' state.apply test=True.

The .pkg seems to be installed, since /opt/homebrew ownership is changed on the target machine after this invocation.

Expected behavior
Nothing is changed on the target machine.

Versions Report

salt --versions-report master:
Salt Version:
          Salt: 3007.3
 
Python Version:
        Python: 3.10.17 (main, May 11 2025, 04:07:13) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
  cryptography: 42.0.5
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       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: 24.0
     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.19.2
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.4.2
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: debian 12.11 bookworm
        locale: utf-8
       machine: x86_64
       release: 6.1.0-37-amd64
        system: Linux
       version: Debian GNU/Linux 12.11 bookworm

minion:

Salt Version:
          Salt: 3007.3
 
Python Version:
        Python: 3.10.17 (main, May 11 2025, 04:02:54) [Clang 16.0.0 (clang-1600.0.26.3)]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
  cryptography: 42.0.5
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       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: 24.0
     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.19.2
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.4.2
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: darwin 24.5.0 
        locale: utf-8
       machine: arm64
       release: 24.5.0
        system: Darwin
       version: 15.5 arm64

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 tracing the macpackage.installed state handling for test=True when version_check reports a changed version, using the provided state and reproduction command. Confirm that a test run makes no changes to the target, including avoiding installation of the .pkg and the resulting ownership change.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.