Return a list of the salt_id names of all available Vagrant VMs on
    this host without regard to the path where they are defined.

    CLI Example:

    .. code-block:: bash

        salt '*' vagrant.list_domains --log-level=info

    The log shows information about all known Vagrant environments
    on this machine. This data is cached and may not be completely
    up-to-date.

def list_domains():
    '''
    Return a list of the salt_id names of all available Vagrant VMs on
    this host without regard to the path where they are defined.

    CLI Example:

    .. code-block:: bash

        salt '*' vagrant.list_domains --log-level=info

    The log shows information about all known Vagrant environments
    on this machine. This data is cached and may not be completely
    up-to-date.
    '''
    vms = []
    cmd = 'vagrant global-status'
    reply = __salt__['cmd.shell'](cmd)
    log.info('--->\n%s', reply)
    for line in reply.split('\n'):  # build a list of the text reply
        tokens = line.strip().split()
        try:
            _ = int(tokens[0], 16)  # valid id numbers are hexadecimal
        except (ValueError, IndexError):
            continue  # skip lines without valid id numbers
        machine = tokens[1]
        cwd = tokens[-1]
        name = get_machine_id(machine, cwd)
        if name:
            vms.append(name)
    return vms