Skip to content

Fixes for function handling - #69902

Draft
lkubb wants to merge 3 commits into
saltstack:3006.xfrom
lkubb:fix-argspec
Draft

Fixes for function handling#69902
lkubb wants to merge 3 commits into
saltstack:3006.xfrom
lkubb:fix-argspec

Conversation

@lkubb

@lkubb lkubb commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Accounts for __kwdefaults__ in namespaced_function/alias_function
  • Accounts for positional-only and keyword-only parameters in salt.utils.args.get_function_argspec/salt.utils.args.format_call/salt.utils.functools.call_function/salt.minion.load_args_and_kwargs
  • Fixes logic errors in salt.utils.functools.call_function

What issues does this PR fix or reference?

Fixes: #69901
Fixes: #69906
Fixes: #69919

Previous Behavior

  • copying drops keyword-only arguments with defaults
  • passing keyword-only args on the CLI, to states and in other contexts fails (3006)/required keyword-only params in functions that have pos-or-keyword params with defaults receive the defaults of the latter when called in contexts other than the CLI (3007+)
  • module.run/the mine merges defaults of pos-or-kw into kwargs when the same param already has a positional arg, causing multiple values to be passed to a single param

New Behavior

  • copying retains the function signature as expected
  • passing keyword-only args on the CLI, to states and in other contexts works as expected (3006)/when this is merged forward, required keyword-only params do not cause confusion regarding which param is required and which one should receive a default
  • module.run/the mine do not merge defaults of params already receiving a positional argument into kwargs and the function call succeeds as expected

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant