Skip to content

[BUG] file.symlink no longer uses file.mod_check_cmd #66939

@OrangeDog

Description

@OrangeDog

Description
The file state module has custom check_cmd logic for running with a temporary file.
This used to work for file.symlink, but has regressed since 3004.

Setup
For example, a onedir installation managing a Debian webserver:

/etc/nginx/sites-enabled/default:
  file.symlink:
    - target: /etc/nginx/sites-available/default
    - check_cmd: nginx -t -c

Steps to Reproduce the behavior
Apply the above state:

[INFO] Running state [/etc/nginx/sites-enabled/default] at time 11:13:20.485750
[INFO] Executing state file.symlink for [/etc/nginx/sites-enabled/default]
[INFO] Executing command 'n' in directory '/root'
[DEBUG] stdout: /bin/sh: 1: n: not found
[DEBUG] retcode: 127
[DEBUG] Last command return code: 127
[ERROR] check_cmd determined the state failed
[INFO] Completed state [/etc/nginx/sites-enabled/default] at time 11:13:20.492677 (duration_in_ms=6.927)

Expected behavior
As in previous versions, it should create a temporary symlink first and then pass append that to the given command.

Versions Report

salt --versions-report
Salt Version:
          Salt: 3006.9

Python Version:
        Python: 3.10.14 (main, Jun 26 2024, 11:44:37) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.6.1
  cryptography: 42.0.5
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.17.0
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: ubuntu 24.04.1 noble
        locale: utf-8
       machine: x86_64
       release: 6.8.0-45-generic
        system: Linux
       version: Ubuntu 24.04.1 noble

Additional context
Presumably caused by #63970

Metadata

Metadata

Assignees

Labels

Bugbroken, incorrect, or confusing behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions