|
Seth House |
at Feb 14, 2015 at 6:38 pm
|
⇧ |
| |
Calling that function should both return a value as well as print to
stdout. Try assigning the result to a variable:
ret = runner.cmd('jobs.list_jobs', [])
print ret.keys()
The reason for this is historical. Runners were one of the earliest
module types and could use a bit of an update. This is issue #9444.
You can track progress there; a workaround is also in a comment on
that issue.
https://github.com/saltstack/salt/issues/9444In the next feature release of Salt that function also gained an
``outputter`` argument which can be set to ``quiet``:
http://docs.saltstack.com/en/latest/ref/runners/all/salt.runners.jobs.html#salt.runners.jobs.lookup_jidThe good news is work on modernizing runners has already begun. Keep
on eye on that issue to watch the progress.
On Thu, Feb 12, 2015 at 5:47 PM, Dennis Jacobfeuerborn
wrote:
Hi,
I'm trying to get access to the information in the job cache from python but
ran into a problem early on:
import salt.runner
import salt.config
opts = salt.config.master_config('/etc/salt/master')
runner = salt.runner.RunnerClient(opts)
runner.cmd('jobs.list_jobs', [])
This code works but the result is printed to stdout and not returned which
is odd behavior. How can I get the printed result into a python variable?
Regards,
Dennis
--
You received this message because you are subscribed to the Google Groups
"Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to salt-users+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.