コード例 #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
ファイル: views.py プロジェクト: duxianghua/salt_gui
 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