Ani
Ani

Reputation: 463

salt-run command using python api

I am looking a way to find how to call salt-run using python api to list in salt master. Tried to find ways but no help! I want to run this command using python api salt-run queue.insert myqueue myitem

Upvotes: 1

Views: 1433

Answers (1)

Mostafa Hussein
Mostafa Hussein

Reputation: 11940

This is how you can achieve it:

import salt.runner

opts = salt.config.master_config('/etc/salt/master')
runner = salt.runner.RunnerClient(opts)

ret = runner.cmd('queue.insert',['myqueue',{'items':['myitem']}])

Upvotes: 5

Related Questions