Skip to content

Unable to use kwarg in salt.function (modules.saltmod) #25317

@arthurzenika

Description

@arthurzenika

I am unable to find a way to feed kwargs through the salt-run state.orchestrate orchestration.

test salt.function:
  salt.function:
    - name: cmd.run
    - tgt: ursa
   - arg:
     - cd /tmp && pwd && whoami
   - kwarg:
       runas: nobody

returns

ursa_master:
----------
          ID: test salt.function
    Function: salt.function
        Name: cmd.run
      Result: True
     Comment: Function ran successfully. Function cmd.run ran on ursa.
     Started: 12:36:51.534337
    Duration: 157.066 ms
     Changes:   
              ursa:
                  /tmp
              root
    Warnings: 'runas' is an invalid keyword argument for 'salt.function'. If you
              were trying to pass additional data to be used in a template
              context, please populate 'context' with 'key: value' pairs. Your
              approach will work until Salt Carbon is out. Please update your
              state files.

tried a good variation of combinations like

   - kwarg:
      context:
         runas: nobody

with no luck.

Can't find a way to get it to work. Is it broken or is the documentation incomplete ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Corerelates to code central or existential to SaltP3Priority 3Runnersbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions