saltstack / saltstack/salt

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

Open
#64,277 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Docker)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

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)

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)

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.

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 at the pcs.auth state entry point and trace how the pcs host auth command result is interpreted, using the configuration and trace output in this issue to reproduce the empty stdout case. Verify the behavior with the provided state configuration and confirm that a successful authorization produces a successful state result without regressing failure handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.