Skip to content

[DOCS] Inconsistent and incomplete documentation around returners #62017

Closed as not planned

Description

@OrangeDog

There are (I think) three global options around returners - return, return_config, and return_kwargs.

https://github.com/saltstack/salt/blob/master/doc/ref/cli/salt.rst
Only documents return.

https://github.com/saltstack/salt/blob/master/salt/utils/parsers.py
Documents return, return_config, and return_kwargs. However, the return_config is incorrectly a duplicate of return.

https://github.com/saltstack/salt/blob/master/doc/topics/jobs/index.rst#scheduler-with-returner
Only mentions returner, by example. Also mentions schedule_returner without further details.

https://github.com/saltstack/salt/blob/master/salt/modules/schedule.py
Does not document any of the above, but the code lists them in SCHEDULE_CONF.

https://github.com/saltstack/salt/blob/master/salt/states/schedule.py
Has an example with returner, return_config, and return_kwargs, but does not explain them. There's some implication that return_config refers to a named section somewhere.

https://github.com/saltstack/salt/blob/master/doc/ref/returners/index.rst
Only mentions return, by example.

https://github.com/saltstack/salt/blob/master/salt/returners/__init__.py
From looking at existing returners, get_returner_options appears to be how you are supposed to access the config and kwargs, but doesn't actually mention them. The documentation it does have appears to have multiple errors:

  • virtualname: the __virtual__() function often returns either True, or (False, msg), not the value of __virtualname__. This may be a wider problem of modules not implementing __virtual__() correctly.
  • ret: the "if" / "if not" cases are identical
  • attrs: from reading the code this is actually supposed to be a dict, and it's unclear what the values are supposed to be
  • profile_attr: "the corresponding key of __salt__" doesn't make sense. __salt__ is the API loader, not a config structure
  • profile_attrs: "... a value is read in the are used to fetch a value ..." - a chunk seems to be missing from the middle of this thought
  • defaults: isn't documented

In short, if you're trying to write or use a returner, it's almost impossible to find how these options are supposed to work.
I think the return_config and return_kwargs are actually passed to the returner function via ret["ret_config"] and ret["ret_kwargs"]?

Activity

  1. added
    documentation
    on May 2, 2022
  2. added
    help-wanted
    docstring-update
    severity-high
    and removed on May 2, 2022
  3. OrangeDog commented on May 5, 2022

    @OrangeDog
    ContributorAuthor

    Some things I've learned about get_returner_options:

    attrs is a map from returned keys to config keys. The config keys are prefixed with {virtualname}., or with {ret["ret_config"]}.{virtualname}. if ret["ret_config"] is present.

    Defaults are applied according to the returned keys, and ret["ret_kwargs"] are added regardless of listed attrs.

    return_config and return_kwargs from the CLI are indeed passed as ret["ret_config"] and ret["ret_kwargs"].

    This all relies on the returner having called get_returner_options correctly, and documenting the attrs it passed, especially if the keys and values are different.

    The slack, pushover, and xmpp returners use the profile_* args, but it's not clear why.

  4. added this to the Sulphur v3006.26 milestone on Jun 25, 2026
  5. dwoz commented on Oct 28, 2026

    @dwoz
    Contributor

    Closing — consolidated into #70585. The checkbox for this item is in the appropriate theme section of that tracker. Please pick up the sub-item there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Returnersdocstring-updatedocumentationhelp-wantedmodule doc standardsseverity-hightime-estimate-sprint

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions