saltstack / saltstack/salt

[BUG] salt-ssh file.recurse behaviour with at least one source file having wrong permissions

Open
#61,876 5 comments 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
When at least one file that is used as source by file.recurse doesn't have the correct permissions for the user running salt-ssh to read the file, then salt-ssh will report Recurse failed: **none** of the specified sources were found though debug mode shows it finds all the other files with correct permissions.

In addition if there is a file.managed using as source one of the files that file.recurse uses ( one having correct permissions ), then file.recurse will report instead of none that this specific file sourced by file.managed will be transferred. If you change the file sourced by file.managed that will be reflected in what file.recurse will show.

Steps to Reproduce the behavior
I have created this repo using docker to showcase both scenarios:

  1. file.recurse
  2. file.recurse with file.managed

for each scenario take a look on how the report changes when the file having wrong permissions is removed.

Expected behavior
I would expect that file.recurse should either error regarding the wrong permissions or transfer the files it can but not have its behaviour change depending on if there is a file.managed transferring a file that is common source for the two states.

Versions Report

          Salt: 3002.6

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.0.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.3
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: 3.12.0
        pygit2: Not Installed
        Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 22.3.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: debian 11 bullseye
        locale: utf-8
       machine: x86_64
       release: 5.10.0-12-amd64
        system: Linux
       version: Debian GNU/Linux 11 bullseye

as well as the latest pip version when used in docker.

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 with the linked salt-ssh-recurse-report repository and reproduce both file.recurse scenarios, including the file.managed variant. Then trace the salt-ssh file.recurse source handling and compare behavior when one source has unreadable permissions. Done means the command reports the permission problem or transfers readable files consistently, without file.managed changing the result.

Written by the indexing model from the issue text.

Assessment

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