Block state execution until you are able to get the lock (or hit the timeout)

def lock(name,
         zk_hosts=None,
         identifier=None,
         max_concurrency=1,
         timeout=None,
         ephemeral_lease=False,
         profile=None,
         scheme=None,
         username=None,
         password=None,
         default_acl=None):
    '''
    Block state execution until you are able to get the lock (or hit the timeout)

    '''
    ret = {'name': name,
           'changes': {},
           'result': False,
           'comment': ''}
    conn_kwargs = {'profile': profile, 'scheme': scheme,
                   'username': username, 'password': password, 'default_acl': default_acl}

    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Attempt to acquire lock'
        return ret

    if identifier is None:
        identifier = __grains__['id']

    locked = __salt__['zk_concurrency.lock'](name,
                                             zk_hosts,
                                             identifier=identifier,
                                             max_concurrency=max_concurrency,
                                             timeout=timeout,
                                             ephemeral_lease=ephemeral_lease,
                                             **conn_kwargs)
    if locked:
        ret['result'] = True
        ret['comment'] = 'lock acquired'
    else:
        ret['comment'] = 'Unable to acquire lock'

    return ret