Skip to content

Documentation for states.state.module is incorrect #44882

Closed

Description

@vernondcole

Description of Issue/Question

The documentation in https://docs.saltstack.com/en/develop/ref/states/all/salt.states.module.html#execution-of-salt-modules-from-within-states is incorrect, and contains no
actual description of the salt.states.module.run call.

The doc gives the example:

mine.send:
  module.run:
    - network.interfaces

Setup

Install a fresh salt master, today's develop HEAD, in a virtual machine.

Steps to Reproduce Issue

I create a similar state in bevy_master.sls:

update_the_grains:
  module.run:
    - saltutil.sync_grains

and the result is:

vagrant@bevymaster:~$ sudo salt-call state.apply bevy_master
local:
    Data failed to compile:
----------
    Too many functions declared in state 'module' in SLS 'bevy_master'

So I remove the "-"

update_the_grains:
  module.run:
    saltutil.sync_grains

This time I get:

vagrant@bevymaster:~$ sudo salt-call state.apply bevy_master
local:
    Data failed to compile:
----------
    State 'update_the_grains' in SLS 'bevy_master' is not formed as a list

Oh, well. Go back to the old way of saying it:

update_the_grains:
  module.run:
    - name: saltutil.sync_grains

and get:

vagrant@bevymaster:~$ sudo salt-call state.apply bevy_master
[WARNING ] The function "module.run" is using its deprecated version and will expire in version "Sodium".

There is no way to win.

Versions Report

At the bottom of the html page it says:

Generated on December 07, 2017 at 07:11:35 MST.
You are viewing docs built from a recent snapshot of the develop branch. `

vagrant@bevymaster:~$ salt --versions-report
Salt Version:
           Salt: 2017.7.0-892-g9865a31
 
Dependency Versions:
           cffi: 1.5.2
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: 0.24.0
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.24.0
         Python: 2.7.12 (default, Nov 20 2017, 18:23:56)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-21-generic
         system: Linux
        version: Ubuntu 16.04 xenial

Activity

  1. vernondcole commented on Dec 8, 2017

    @vernondcole
    ContributorAuthor

    With no actual description of the calling parameters, there is no way of guessing what is wanted.

  2. lorengordon commented on Dec 8, 2017

    @lorengordon
    Contributor

    Not sure why the documented list form isn't working, but I think you were close with this one:

    update_the_grains:
      module.run:
        saltutil.sync_grains
    

    The doc (which is confusing in the presentation of new vs old forms) does have examples where the new form is a dictionary:

    call_something:
      module.run:
        git.fetch:
          - cwd: /path/to/my/repo
          - user: myuser
          - opts: '--all'
    

    So, based on that example, I think if you write yours as a dictionary, it will work without the deprecation warning:

    update_the_grains:
      module.run:
        saltutil.sync_grains: {}
    
  3. added
    needs-more-info
    on Dec 8, 2017
  4. added this to the Blocked milestone on Dec 8, 2017
  5. marco-m commented on Apr 20, 2018

    @marco-m

    Hello @Ch3LL I don't think this is blocked by an answer for @vernondcole , since what he reports is still valid, I can only copy and paste his text:

    The very first example in the documentation

    mine.send:
      module.run:
        - network.interfaces
    

    is simply broken :-)

  6. Ch3LL commented on Apr 23, 2018

    @Ch3LL
    Contributor

    does this work for you:

    mine.send:
      module.run:
        - network.interfaces: []
    
  7. marco-m commented on Apr 23, 2018

    @marco-m

    here is what I get:

    $ sudo salt-call state.apply foo
    [WARNING ] The function "module.run" is using its deprecated version and will expire in version "Sodium".
    [ERROR   ] The following arguments are missing: func
    local:
    ----------
              ID: mine.send
        Function: module.run
          Result: False
         Comment: The following arguments are missing: func
         Started: 19:58:49.376001
        Duration: 1.514 ms
         Changes:
    
    Summary for local
    ------------
    Succeeded: 0
    Failed:    1
    
  8. Ch3LL commented on Apr 24, 2018

    @Ch3LL
    Contributor

    apologies the way its written is with the new format, which requires in the config:

    use_superseded:
      - module.run
    

    I think we can definitely improve the documentation to clearly show which format is which.

  9. added
    documentation
    bug
    severity-medium
    P2
    and removed
    needs-more-info
    on Apr 24, 2018
  10. modified the milestones: Blocked, Approved on Apr 24, 2018
  11. self-assigned this
    on Apr 24, 2018
  12. b-a-t commented on Nov 15, 2018

    @b-a-t

    Hit this just recently. The error message is very vague and documentation is (still) misleading. Based on some googling I came down to this announcement according to which you should either use old syntax:

    mine.send:
      module.run:
        - name: network.interfaces
    

    and get deprecation warning or use new syntax:

    mine.send:
      module.run:
        - network.interfaces:
    

    with the minion config having stanza:

    use_superseded:
      - module.run
    
  13. cr1st1p commented on Jan 26, 2019

    @cr1st1p

    #51349 module.run doc needs improvement about the 'new format' ...

  14. devurandom commented on Mar 6, 2019

    @devurandom

    apologies the way its written is with the new format, which requires in the config:

    use_superseded:
      - module.run
    

    I think we can definitely improve the documentation to clearly show which format is which.

    How do I set use_superseded for salt-ssh?

  15. waynew commented on Apr 15, 2019

    @waynew
    Contributor

    @devurandom When I did a Google search for salt-ssh config file it took me to https://docs.saltstack.com/en/latest/topics/ssh/ which has a subsection https://docs.saltstack.com/en/latest/topics/ssh/#minion-config

    In there you can find that you should edit /etc/salt/master and add:

    ssh_minion_config:
      use_superseded:
        - module.run
    
  16. added a commit that references this issue on Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2bugdocumentationseverity-medium

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions