saltstack / saltstack/salt

[BUG] invalid arguments passed into fileserver.update from saltutil runner

Open
#66,793 4 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
Running the fileserver.update through saltutil.runner causes extra argument __pub_user to be passed into the function

Setup
Salt 3006.x and above.

Steps to Reproduce the behavior
Run: salt master_minion saltutil.runner fileserver.update

Error:


    Passed invalid arguments: update() got an unexpected keyword argument '__pub_user'

    Usage:

        Update the fileserver cache. If no backend is provided, then the cache for
        all configured backends will be updated.

        backend
            Narrow fileserver backends to a subset of the enabled ones.

            .. versionchanged:: 2015.5.0
                If all passed backends start with a minus sign (``-``), then these
                backends will be excluded from the enabled backends. However, if
                there is a mix of backends with and without a minus sign (ex:
                ``backend=-roots,git``) then the ones starting with a minus
                sign will be disregarded.

                Additionally, fileserver backends can now be passed as a
                comma-separated list. In earlier versions, they needed to be passed
                as a python list (ex: ``backend="['roots', 'git']"``)

        kwargs
            Pass additional arguments to backend. See example below

        CLI Example:

        .. code-block:: bash

            salt-run fileserver.update
            salt-run fileserver.update backend=roots,git
            salt-run fileserver.update backend=git remotes=myrepo,yourrepo

Expected behavior

master_minion:
    True

Additional context
Was introduced with this commit: https://github.com/saltstack/salt/commit/d5b31df509c45f7d67e5b16900262400550a7ab5

Workaround:
Edit modules/saltutil.py & comment out:

pub_data["user"] = kwargs.pop("__pub_user", "UNKNOWN")

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: unknown
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 22.04.4 jammy
locale: utf-8
machine: x86_64
release: 6.5.0-1020-aws
system: Linux
version: Ubuntu 22.04.4 jammy

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 in modules/saltutil.py at the handling of __pub_user and trace the saltutil.runner path for fileserver.update. Reproduce with salt master_minion saltutil.runner fileserver.update and verify that the call no longer passes an invalid argument and returns the expected master_minion: True result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.