Advertisement
Guest User

Untitled

a guest
Dec 17th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. In [1]: from salt.client.api import APIClient
  2.  
  3. In [2]: client = APIClient()
  4.  
  5. #Use this data structure to lookup info for a single jid
  6. In [3]: cmd_jid = {'fun': 'runner.jobs.lookup_jid', 'kwarg': {'jid': '20131130154312264323'}, 'username': 'adi', 'password': 'cloud', 'eauth': 'pam'}
  7.  
  8. #Use this data structure to lookup info for all jids
  9.  
  10. In [3]: cmd_all = {'fun': 'runner.jobs.list_all', 'username': 'adi', 'password': 'cloud', 'eauth': 'pam'}
  11.  
  12. In [4]: client.run(cmd_jid) # or client.run(cmd_all)
  13. #Poll for events
  14.  
  15. while True:
  16.         val = client.get_event(wait=5, tag='salt/', full=True)
  17.         if val:
  18.                 pprint.pprint(val)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement