saltstack / saltstack/salt

[Bug]: `module.run` fails when passing positional args to parameters with defaults

Open
#69,919 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What happened?
$ salt-call state.single module.run foo 'test.rand_str=[999]'
[ERROR   ] 'test.rand_str' failed: rand_str() got multiple values for argument 'size'
local:
----------
          ID: foo
    Function: module.run
      Result: False
     Comment: 'test.rand_str' failed: rand_str() got multiple values for argument 'size'
     Changes:

When merging keyword defaults, module.run does not check whether a parameter has already received a positional argument, leading to an exception.

Type of salt install

Official deb

Major version

3006.x, 3007.x, 3008.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

ubuntu-24.04

salt --versions-report output
Current HEAD of 3006.x

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 by reproducing the supplied salt-call state.single module.run command with test.rand_str and inspect the module.run argument handling, especially keyword defaults combined with positional arguments. Done means the command no longer raises the duplicate size-argument error and returns a successful result for parameters with defaults.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.