saltstack / saltstack/salt

Thorium runner.cmd is not working

Open
#50,628 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help-wanted severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue/Question

Thorium's runner.cmd is not building arguments properly (I guess).

Setup

Create something like this in some example sls under thorium_roots:

some_orchestrate:
  runner.cmd:
    - func: state.orchestrate
    - arg:
        - some.sls.file
    - kwargs:
        saltenv: server

For convenience setup rawfile_json

Steps to Reproduce Issue

Send some events to trigger thorium
saltenv will not be passed to the state.orchestrate
The event dump:

{"tag": "salt/run/20181124220603287357/new", "data": {"fun": "runner.state.orchestrate", "fun_args": ["some.sls.file", {"orchestration_jid": "20181124220603287357"}]

Trying to:

some_orchestrate:
  runner.cmd:
    - func: state.orchestrate
    - arg:
        - some.sls.file
        - saltenv: server

Brings me closer to solution but still doesn't work

{"tag": "salt/run/20181124221236510322/new", "data": {"fun": "runner.state.orchestrate", "fun_args": ["some.sls.file", {"saltenv": "server"}, {"orchestration_jid": "20181124221236510322"}], "jid": "20181124221236510322", "user": "root", "_stamp": "2018-11-24T21:12:37.190855"}}

Mind separated {'orchestration_jid': ...}

How do I get this working (workaround)?
I'm guessing the problem is here (thorium/runner.py):

    local_opts = {}
    local_opts.update(__opts__)
    local_opts['async'] = True  # ensure this will be run asynchronous
    local_opts.update({
        'fun': func,
        'arg': arg,
        'kwarg': kwargs
    })
    runner = salt.runner.Runner(local_opts)
    runner.run()

Could you give me hints or code reference where these options are properly handled so that I'll fix it myself?

Versions Report
Salt Version:
           Salt: 2018.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: 3.5.1
          gitdb: 2.0.0
      gitpython: 2.1.1
          ioflo: Not Installed
         Jinja2: 2.9.4
        libgit2: 0.24.5
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.24.2
         Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.1
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1

System Versions:
           dist: debian 9.6
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-8-amd64
         system: Linux
        version: debian 9.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with thorium/runner.py and reproduce the runner.cmd state.orchestrate example using the shown saltenv and event output. Compare how the runner options are assembled and handled, then verify that saltenv reaches state.orchestrate in the intended keyword arguments while orchestration_jid remains separate.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.