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
14.11k stars 5.47k forks source link

[BUG] pcs.auth shows empty failed execution with PCS version 0.11.3 #64277

Open derdeagle opened 1 year ago

derdeagle commented 1 year ago

Description With PCS version 0.11.3 the execution of pcs.auth fails without a message even though the execution itself was successful. After digging a bit through the state and module and setting the minion log level to trace I noticed that the output of the pcs host auth command is not in stdout (which is used by the pcs-state) but rather stderr which is not used. Please see the config and output below.

Minion log

2023-05-13 20:48:03,304 [salt.loaded.int.states.pcs:32  ][TRACE   ][2009] Output of pcs.auth: {'pid': 2125, 'retcode': 0, 'stdout': '', 'stderr': 'pcstest02.example.com: Authorized\npcstest01.example.com: Authorized\npcstest03.example.com: Authorized'}

State output

          ID: pcs_cluster_salttest_auth
    Function: pcs.auth
        Name: pcs_auth__auth
      Result: False
     Comment: 
     Started: 20:17:19.902411
    Duration: 7135.502 ms
     Changes:   

State config

pcs_cluster_{{ cluster }}_auth:
  pcs.auth:
  - name: pcs_auth__auth
  - nodes: {{ cluster_config["nodes"] }}
  - pcsuser: {{ cluster_config["pcsuser"] }}
  - pcspasswd: {{ cluster_config["pcspasswd"] }}

which gets rendered to:

pcs_cluster_salttest_auth:
  pcs.auth:
  - name: pcs_auth__auth
  - nodes: ['pcstest01.example.com', 'pcstest02.example.com', 'pcstest03.example.com']
  - pcsuser: hacluster
  - pcspasswd: haclusterpw

Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

Steps to Reproduce the behavior Use the config shown above and apply the state.

Expected behavior After changing the PCS-state to use stderr instead of stdout the state at least returned successfully which is what I expect. Yet I don't know if that might break something else.

Screenshots I don't think screenshots would be of any help in this case.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) **Master (Docker)** ```yaml Salt Version: Salt: 3005.1 Dependency Versions: cffi: 1.14.6 cherrypy: unknown dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.1.0 libgit2: 1.1.0 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.17 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: 1.6.1 Python: 3.7.13 (default, Apr 20 2022, 03:16:50) python-gnupg: 0.4.8 PyYAML: 5.4.1 PyZMQ: 18.0.1 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.1 System Versions: dist: alpine 3.14.6 locale: UTF-8 machine: x86_64 release: 4.18.0-489.el8.x86_64 system: Linux version: Alpine Linux 3.14.6 ``` **Minion (VM, Rocky Linux 9)** ```yaml Salt Version: Salt: 3005.1 Dependency Versions: cffi: 1.14.5 cherrypy: Not Installed dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.11.3 libgit2: Not Installed M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.3 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.20 pycrypto: Not Installed pycryptodome: 3.14.0 pygit2: Not Installed Python: 3.9.14 (main, Jan 9 2023, 00:00:00) python-gnupg: Not Installed PyYAML: 5.4.1 PyZMQ: 22.3.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: rocky 9.1 Blue Onyx locale: utf-8 machine: x86_64 release: 5.14.0-162.23.1.el9_1.x86_64 system: Linux version: Rocky Linux 9.1 Blue Onyx ```

Additional context Add any other context about the problem here.

derdeagle commented 1 year ago

Taking a look at the PCS sources I think that commit "d4383f6cbd7986c5eb39b9cefaa8faefa175aca6" is causing the change. The first appearance of this commit is in the tag "v0.11.1.alpha.1~8" of PCS.