예제 #1
0
def get_api_client():
    opts = salt.config.client_config(settings.SALT_CONFIG['master_config'])
    opts.update(output='quiet')
    client = saltapi.APIClient(opts=opts)
    return client
예제 #2
0
 def __init__(self, opts):
     self.opts = opts
     self.api = saltapi.APIClient(opts)
예제 #3
0
import salt.config
import saltapi

opts = salt.config.master_config('/etc/salt/master')
api = saltapi.APIClient(opts)


def list_all(*args, **kwargs):
    fun = 'key.list_all'
    ret = api.wheel(fun)
    ret.pop('local')
    for i in ret:
        if i != 'local':
            ret[i] = [{'select': False, 'mid': x} for x in ret[i]]
    return ret


def accept(minions, **kwargs):
    fun = 'key.accept'
    if not isinstance(minions, list):
        raise ValueError('minions must be formatted as a list')
    return api.wheel(fun, arg=minions)


def delete(minions, **kwargs):
    fun = 'key.delete'
    if not isinstance(minions, list):
        raise ValueError('minions must be formatted as a list')
    return api.wheel(fun, arg=minions)

예제 #4
0
 def __init__(self):
     super(BaseView, self).__init__()
     self.opts = salt.config.master_config('/etc/salt/master')
     self.api = saltapi.APIClient(self.opts)
예제 #5
0
def get_api_client():
    opts = salt.config.client_config(
        settings.SALT_CONFIG['master_config']
        )
    client = saltapi.APIClient(opts=opts)
    return client