コード例 #1
0
    def __init__(self):
        """
        MultiJob constructor

        """
        self._jobs = {}
        self.client = APIClient(opts=MASTER_OPTIONS)
        self.handler = Handler()
コード例 #2
0
 def runner_manage_present_async(self):
     '''
     Make a call to runner.manage.present and
     test against returned SSE data
     '''
     self.app.post_json('/run',
                        dict(client='master',
                             fun='runner.manage.present',
                             kwarg={}),
                        headers=self.headers)
     keep_looping = True
     client = APIClient()
     sse = None
     while keep_looping:
         sse = client.get_event(wait=5, tag='salt/', full=True)
         keep_looping = False
     self.assertNotEqual(sse, None)
コード例 #3
0
 def runner_manage_present_datastructure(self):
     '''
     Make a call to runner.manage.present and
     test data structure integrity
     '''
     resp = self.app.post_json('/run',
                               dict(client='master',
                                    fun='runner.manage.present',
                                    kwarg={}),
                               headers=self.headers)
     tag = resp.json_body['return'][0]['tag']
     client = APIClient()
     data = None
     while not data:
         sse = client.get_event(wait=0.01, tag='salt/', full=True)
         if sse['tag'] == '%s/ret' % tag:
             data = sse['data']['return']
     self.assertNotEqual(data, None)
コード例 #4
0
ファイル: hostnames.py プロジェクト: sacharya/RPC-Heat-Ambari
from salt.client.api import APIClient

client = APIClient()

mine_args = ('roles:ambari', 'host', 'grain')
resp = client.localClient.cmd('roles:ambari-server',
                              'mine.get',
                              arg=mine_args,
                              expr_form='grain')
hosts = resp.values()[0].values()
for host in hosts:
    print host