def acls(name, acls, version=-1, profile=None, hosts=None, scheme=None,
         username=None, password=None, default_acl=None):
    '''
    Update acls on a znode

    name
        path to znode

    acls
        list of acl dictionaries to set on znode

    version
        Specify the version which should be deleted
        Default: -1 (always match)

    profile
        Configured Zookeeper profile to authenticate with (Default: None)

    hosts
        Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)

    scheme
        Scheme to authenticate with (Default: 'digest')

    username
        Username to authenticate (Default: None)

    password
        Password to authenticate (Default: None)

    default_acl
        Default acls to assign if a node is created in this connection (Default: None)

    .. code-block:: yaml

        update acls:
          zookeeper.acls:
            - name: /test/name
            - acls:
              - username: daniel
                password: test
                all: True
              - username: gtmanfred
                password: test
                all: True
    '''
    ret = {'name': name,
           'result': False,
           'comment': 'Failed to set acls on znode {0}'.format(name),
           'changes': {}}
    connkwargs = {'profile': profile, 'hosts': hosts, 'scheme': scheme,
                  'username': username, 'password': password,
                  'default_acl': default_acl}
    if isinstance(acls, dict):
        acls = [acls]
    chk_acls = [__salt__['zookeeper.make_digest_acl'](**acl) for acl in acls]

    if not __salt__['zookeeper.exists'](name, **connkwargs):
        ret['comment'] += ': Znode does not exist'
        return ret

    cur_acls = __salt__['zookeeper.get_acls'](name, **connkwargs)
    if _check_acls(cur_acls, chk_acls):
        ret['result'] = True
        ret['comment'] = 'Znode {0} acls already set'.format(name)
        return ret

    if __opts__['test'] is True:
        ret['result'] = None
        ret['comment'] = 'Znode {0} acls will be updated'.format(name)
        ret['changes']['old'] = cur_acls
        ret['changes']['new'] = chk_acls
        return ret

    __salt__['zookeeper.set_acls'](name, acls, version, **connkwargs)

    new_acls = __salt__['zookeeper.get_acls'](name, **connkwargs)
    ret['changes'] = {'old': cur_acls, 'new': new_acls}
    if _check_acls(new_acls, chk_acls):
        ret['result'] = True
        ret['comment'] = 'Znode {0} acls updated'.format(name)
        return ret
    ret['comment'] = 'Znode {0} acls failed to update'.format(name)
    return ret
def acls ( name , acls , version = - 1 , profile = None , hosts = None , scheme = None , username = None , password = None , default_acl = None ) : ret = { 'name' : name , 'result' : False , 'comment' : 'Failed to set acls on znode {0}' . format ( name ) , 'changes' : { } } connkwargs = { 'profile' : profile , 'hosts' : hosts , 'scheme' : scheme , 'username' : username , 'password' : password , 'default_acl' : default_acl } if isinstance ( acls , dict ) : acls = [ acls ] chk_acls = [ __salt__ [ 'zookeeper.make_digest_acl' ] ( ** acl ) for acl in acls ] if not __salt__ [ 'zookeeper.exists' ] ( name , ** connkwargs ) : ret [ 'comment' ] += ': Znode does not exist' return ret cur_acls = __salt__ [ 'zookeeper.get_acls' ] ( name , ** connkwargs ) if _check_acls ( cur_acls , chk_acls ) : ret [ 'result' ] = True ret [ 'comment' ] = 'Znode {0} acls already set' . format ( name ) return ret if __opts__ [ 'test' ] is True : ret [ 'result' ] = None ret [ 'comment' ] = 'Znode {0} acls will be updated' . format ( name ) ret [ 'changes' ] [ 'old' ] = cur_acls ret [ 'changes' ] [ 'new' ] = chk_acls return ret __salt__ [ 'zookeeper.set_acls' ] ( name , acls , version , ** connkwargs ) new_acls = __salt__ [ 'zookeeper.get_acls' ] ( name , ** connkwargs ) ret [ 'changes' ] = { 'old' : cur_acls , 'new' : new_acls } if _check_acls ( new_acls , chk_acls ) : ret [ 'result' ] = True ret [ 'comment' ] = 'Znode {0} acls updated' . format ( name ) return ret ret [ 'comment' ] = 'Znode {0} acls failed to update' . format ( name ) return ret
Update acls on a znode

    name
        path to znode

    acls
        list of acl dictionaries to set on znode

    version
        Specify the version which should be deleted
        Default: -1 (always match)

    profile
        Configured Zookeeper profile to authenticate with (Default: None)

    hosts
        Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)

    scheme
        Scheme to authenticate with (Default: 'digest')

    username
        Username to authenticate (Default: None)

    password
        Password to authenticate (Default: None)

    default_acl
        Default acls to assign if a node is created in this connection (Default: None)

    .. code-block:: yaml

        update acls:
          zookeeper.acls:
            - name: /test/name
            - acls:
              - username: daniel
                password: test
                all: True
              - username: gtmanfred
                password: test
                all: True