Closed xq2248 closed 5 years ago
Salt Version: Salt: 2019.2.0
Dependency Versions: cffi: Not Installed cherrypy: unknown dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed ioflo: 1.3.8 Jinja2: 2.8.1 libgit2: Not Installed libnacl: 1.6.1 M2Crypto: 0.31.0 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.5.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 3.6.8 (default, Apr 25 2019, 21:02:35) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.3.0 RAET: 0.6.6 smmap: Not Installed timelib: 0.2.4 Tornado: 4.4.2 ZMQ: 4.1.4
System Versions: dist: centos 7.4.1708 Core locale: UTF-8 machine: x86_64 release: 3.10.0-693.11.6.el7.x86_64 system: Linux version: CentOS Linux 7.4.1708 Core
Like job1
, the queue
is also an argument for the state.sls
function:
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.state.html#salt.modules.state.sls
salt.modules.state.sls(mods, test=None, exclude=None, queue=False, sync_mods=None, **kwargs)
Therefore, you need to pass it inside the kwarg
dictionary. Here is an example:
curl -ksS http://localhost:8000/run \
-H 'Content-type: application/json' \
-H 'Accept: application/x-yaml' \
-d '[{"client":"local", "eauth":"auto", "username":"username", "password":"password", "tgt":"minion123", "fun":"state.sls", "arg": ["job1"], "kwarg": {"queue": true}}]'
More examples: https://docs.saltstack.com/en/latest/ref/netapi/all/salt.netapi.rest_cherrypy.html#usage
@max-arnold thanks a lot.
We want minion123 to execute two jobs job1.sls and job2.sls at the same time.
The following salt commands with queue=True parameter: salt 'minion123' state.sls job1 queue=True salt 'minion123' state.sls job2 queue=True Job1 and job2 are excuted one by one sucessfully.
But queue=True does not work in rest call. The restful call to salt-api of job1 as follows: { "tgt": "minion123", "arg": [ "job1"
], "client": "local", "fun": "state.sls", "queue": true }
The restful call to salt-api of job2 as follows: { "tgt": "minion123", "arg": [ "job2"
], "client": "local", "fun": "state.sls", "queue": true }
With rest calls , job1 success, job2 failed immediately. It seems that queue takes no effect. We tried other formats of queue parameter: "queue": True "queue": "true" "queue": "True" All of above do not work.
What is the correct json format of queue parameter? Or rest call of salt-api does not support queue as a optional parameter? Or bug?