Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kwargs to returner data. #257

Open
n-holmstedt opened this issue Oct 29, 2021 · 3 comments
Open

Add kwargs to returner data. #257

n-holmstedt opened this issue Oct 29, 2021 · 3 comments
Labels
bug Something isn't working returner

Comments

@n-holmstedt
Copy link

n-holmstedt commented Oct 29, 2021

Is your feature request related to a problem? Please describe.
Using a returner for event based automation. I'd like to see the key-value arguments passed to the salt-function.

Describe the solution you'd like
Could one append kwargs to fun_args in the data sent to the returner? I believe napalm does this.

Describe alternatives you've considered
forking.

Additional context
none

@mirceaulinic
Copy link
Owner

I think that should be supported:

  --return=RETURNER     The name of the Returner module to use for sending
                        data to various external systems.
  --return-config=RETURNER_CONF
                        Specify an alternative Returner config.
  --return-kwargs=RETURNER_KWARGS
                        Set Returner options at the command line.

Or is there something different you'd like? Please explain.

@n-holmstedt
Copy link
Author

Sorry, bad explanation,

The command
salt-sproxy minion module.function foo bar=baz --return=my_module
yields the following data structure to the return module:

{
  'id': 'minion',
  'fun': 'module.function',
  'fun_args: ['foo']
  ...
}

I would like it to do:

{
  'id': 'minion',
  'fun': 'module.function',
  'fun_args: ['foo' {'bar':'baz'}]
  ...
}

I can make it do exactly that by appending the kwargs to the args list in salt_call before ret_data is populated

    args.append(kwargs)
    ret_data = {
                'id': opts['id'],
                'jid': jid,

Is that a bit clearer? Bit hard to explain i guess.

@mirceaulinic
Copy link
Owner

Ah, yes, I see it now. Yep, @n-holmstedt - you solution sound good, please feel free to open a PR if you would like to! 😄

@mirceaulinic mirceaulinic added bug Something isn't working returner and removed pending triage feature request labels Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working returner
Projects
None yet
Development

No branches or pull requests

2 participants