Example #1
0
    def master_call(self, **kwargs):
        '''
        Execute a runner function through the master network interface (eauth).

        This function requires that :conf_master:`external_auth` is configured
        and the user is authorized to execute runner functions: (``@runner``).

        .. code-block:: python

            runner.master_call({
                'fun': 'jobs.list_jobs',
                'username': '******',
                'password': '******',
                'eauth': 'pam',
            })
        '''
        load = kwargs
        load['cmd'] = 'runner'
        # sreq = salt.payload.SREQ(
        #         'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
        #        )
        sreq = salt.transport.Channel.factory(self.opts, crypt='clear')
        ret = sreq.send(load)
        if isinstance(ret, collections.Mapping):
            if 'error' in ret:
                raise_error(**ret['error'])
        return ret
Example #2
0
    def master_call(self, **kwargs):
        '''
        Execute a runner function through the master network interface (eauth).

        This function requires that :conf_master:`external_auth` is configured
        and the user is authorized to execute runner functions: (``@runner``).

        .. code-block:: python

            runner.master_call(
                fun='jobs.list_jobs',
                username='******',
                password='******',
                eauth='pam'
            )
        '''
        load = kwargs
        load['cmd'] = 'runner'
        # sreq = salt.payload.SREQ(
        #         'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
        #        )
        sreq = salt.transport.Channel.factory(self.opts, crypt='clear')
        ret = sreq.send(load)
        if isinstance(ret, collections.Mapping):
            if 'error' in ret:
                raise_error(**ret['error'])
        return ret
Example #3
0
 def master_call(self, **kwargs):
     '''
     Execute a wheel function through the master network interface (eauth).
     '''
     load = kwargs
     load['cmd'] = 'wheel'
     sreq = salt.payload.SREQ(
         'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts), )
     ret = sreq.send('clear', load)
     if isinstance(ret, collections.Mapping):
         if 'error' in ret:
             raise_error(**ret['error'])
     return ret
Example #4
0
 def master_call(self, **kwargs):
     '''
     Execute a function through the master network interface.
     '''
     load = kwargs
     load['cmd'] = self.client
     channel = salt.transport.Channel.factory(self.opts,
                                              crypt='clear',
                                              usage='master_call')
     ret = channel.send(load)
     if isinstance(ret, collections.Mapping):
         if 'error' in ret:
             raise_error(**ret['error'])
     return ret
Example #5
0
 def master_call(self, **kwargs):
     '''
     Execute a function through the master network interface.
     '''
     load = kwargs
     load['cmd'] = self.client
     channel = salt.transport.Channel.factory(self.opts,
                                              crypt='clear',
                                              usage='master_call')
     ret = channel.send(load)
     if isinstance(ret, collections.Mapping):
         if 'error' in ret:
             raise_error(**ret['error'])
     return ret
 def master_call(self, **kwargs):
     '''
     Execute a wheel function through the master network interface (eauth).
     '''
     load = kwargs
     load['cmd'] = 'wheel'
     sreq = salt.payload.SREQ(
             'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
             )
     ret = sreq.send('clear', load)
     if isinstance(ret, collections.Mapping):
         if 'error' in ret:
             raise_error(**ret['error'])
     return ret
Example #7
0
File: runner.py Project: s7726/salt
 def master_call(self, **kwargs):
     '''
     Execute a runner function through the master network interface (eauth).
     '''
     load = kwargs
     load['cmd'] = 'runner'
     # sreq = salt.payload.SREQ(
     #         'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
     #        )
     sreq = salt.transport.Channel.factory(self.opts, crypt='clear')
     ret = sreq.send(load)
     if isinstance(ret, collections.Mapping):
         if 'error' in ret:
             raise_error(**ret['error'])
     return ret
Example #8
0
 def master_call(self, **kwargs):
     '''
     Execute a wheel function through the master network interface (eauth).
     '''
     load = kwargs
     load['cmd'] = 'wheel'
     master_uri = 'tcp://' + salt.utils.ip_bracket(self.opts['interface']) + \
                                                   ':' + str(self.opts['ret_port'])
     channel = salt.transport.Channel.factory(self.opts,
                                              crypt='clear',
                                              master_uri=master_uri)
     ret = channel.send(load)
     if isinstance(ret, collections.Mapping):
         if 'error' in ret:
             raise_error(**ret['error'])
     return ret
Example #9
0
 def master_call(self, **kwargs):
     '''
     Execute a wheel function through the master network interface (eauth).
     '''
     load = kwargs
     load['cmd'] = 'wheel'
     master_uri = 'tcp://' + salt.utils.ip_bracket(self.opts['interface']) + \
                                                   ':' + str(self.opts['ret_port'])
     channel = salt.transport.Channel.factory(self.opts,
                                              crypt='clear',
                                              master_uri=master_uri)
     ret = channel.send(load)
     if isinstance(ret, collections.Mapping):
         if 'error' in ret:
             raise_error(**ret['error'])
     return ret
Example #10
0
    def master_call(self, **kwargs):
        '''
        Execute a wheel function through the master network interface (eauth).

        This function requires that :conf_master:`external_auth` is configured
        and the user is authorized to execute wheel functions: (``@wheel``).

        .. code-block:: python

            >>> wheel.master_call(**{
                'fun': 'key.finger',
                'match': 'jerry',
                'eauth': 'auto',
                'username': '******',
                'password': '******',
            })
            {'data': {
                '_stamp': '2013-12-19_22:47:44.427338',
                'fun': 'wheel.key.finger',
                'jid': '20131219224744416681',
                'return': {'minions': {'jerry': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}},
                'success': True,
                'tag': 'salt/wheel/20131219224744416681',
                'user': '******'
            },
            'tag': 'salt/wheel/20131219224744416681'}
        '''
        load = kwargs
        load['cmd'] = 'wheel'
        sreq = salt.payload.SREQ(
                'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
                )
        ret = sreq.send('clear', load)
        if isinstance(ret, collections.Mapping):
            if 'error' in ret:
                raise_error(**ret['error'])
        return ret
Example #11
0
    def master_call(self, **kwargs):
        '''
        Execute a wheel function through the master network interface (eauth).

        This function requires that :conf_master:`external_auth` is configured
        and the user is authorized to execute wheel functions: (``@wheel``).

        .. code-block:: python

            >>> wheel.master_call(**{
                'fun': 'key.finger',
                'match': 'jerry',
                'eauth': 'auto',
                'username': '******',
                'password': '******',
            })
            {'data': {
                '_stamp': '2013-12-19_22:47:44.427338',
                'fun': 'wheel.key.finger',
                'jid': '20131219224744416681',
                'return': {'minions': {'jerry': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}},
                'success': True,
                'tag': 'salt/wheel/20131219224744416681',
                'user': '******'
            },
            'tag': 'salt/wheel/20131219224744416681'}
        '''
        load = kwargs
        load['cmd'] = 'wheel'
        sreq = salt.payload.SREQ(
            'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts), )
        ret = sreq.send('clear', load)
        if isinstance(ret, collections.Mapping):
            if 'error' in ret:
                raise_error(**ret['error'])
        return ret