def list_policies(vhost="/", runas=None):
    ret = {}
    if runas is None:
        runas = salt.utils.get_user()
    output = __salt__['cmd.run'](
        ['rabbitmqctl', 'list_policies', '-p', vhost],
        runas=runas,
        python_shell=False)
    for line in salt.utils.itertools.split(output, '\n'):
        if '...' not in line:
            parts = line.split('\t')
            if len(parts) not in (5, 6):
                continue
            vhost, name = parts[0], parts[1]
            if vhost not in ret:
                ret[vhost] = {}
            ret[vhost][name] = {}
            # How many fields are there? - 'apply_to' was inserted in position
            # 2 at some point
            offset = len(parts) - 5
            if len(parts) == 6:
                ret[vhost][name]['apply_to'] = parts[2]
            ret[vhost][name].update({
                'pattern': parts[offset+2],
                'definition': parts[offset+3],
                'priority': parts[offset+4]
            })
    log.debug('Listing policies: {0}'.format(ret))
    return ret
Return a dictionary of policies nested by vhost and name
dataset/ETHPy150Open saltstack/salt/salt/modules/rabbitmq.py/list_policies