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

Document passing **kwargs through states.module.run #8392

Closed
davidn opened this issue Nov 11, 2013 · 4 comments
Closed

Document passing **kwargs through states.module.run #8392

davidn opened this issue Nov 11, 2013 · 4 comments
Labels
Documentation Relates to Salt documentation stale
Milestone

Comments

@davidn
Copy link
Contributor

davidn commented Nov 11, 2013

To pass kwargs through states.module.run (and states.module.wait) one must pass them in a very specific way. They must be a dict in the options to run, passed under the variable corresponding to the underlying module you wish to run's kwargs name.

For example, mysql.query is defined as query(database, query, **connection_args), so you must put in the jinja:

your_name:
  module.wait:
    - name: mysql.query
    - watch:
      - something
    - database: dbname
    - query: SQL STATEMENT;
    - connection_args:
        query_kw_arg: value
        connection_host: 'localhost'

The connection_host gives away why this is important - I am trying to override the mysql connection parameters in salt master (which are set up for a returner).

This is highly uninituitive as usually kwargs are siblings of the other args.

@basepi
Copy link
Contributor

basepi commented Nov 11, 2013

Thanks for this report! We'll get this fixed. I wonder how easy it would be to allow for sibling args, as you mentioned? But we'll fix the documentation either way.

@basepi basepi modified the milestones: Helium, Hydrogen Release Feb 4, 2014
@edlane
Copy link
Contributor

edlane commented Mar 10, 2014

I have encountered this same issue wrt the "lxc" execution module. Except in this case **kwargs is now "options". It's very frustrating to determine the calling parameters for an "sls" function when they can only be found in the source code.
From http://docs.saltstack.com/ref/modules/all/salt.modules.lxc.html#salt.modules.lxc.create :

salt 'minion' lxc.create name [config=config_file] \
        [profile=profile] [template=template_name] \
        [backing=backing_store] [ vgname=volume_group] \
        [size=filesystem_size] [options=template_options]

It's not clear that in the case of the CLI you must provide the template_name as "template="
and then in the "sls" file it is required as a dictionary entry inside "options"

# lxc.sls

doit:
  module.run:
    - name: lxc.create
    - m_name: lxc-testme
    - options:
      template: ubuntu

@basepi basepi modified the milestones: Approved, Helium Apr 21, 2014
@gravyboat
Copy link
Contributor

Really we should just write a whole page on what kwargs are, and passing them through with some examples.

refs: #12446

@stale
Copy link

stale bot commented Aug 28, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot closed this as completed Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Relates to Salt documentation stale
Projects
None yet
Development

No branches or pull requests

4 participants