List all zones

    verbose : boolean
        display additional zone information
    installed : boolean
        include installed zones in output
    configured : boolean
        include configured zones in output
    hide_global : boolean
        do not include global zone

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.list

def list_zones(verbose=True, installed=False, configured=False, hide_global=True):
    '''
    List all zones

    verbose : boolean
        display additional zone information
    installed : boolean
        include installed zones in output
    configured : boolean
        include configured zones in output
    hide_global : boolean
        do not include global zone

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.list
    '''
    zones = {}

    ## fetch zones
    header = 'zoneid:zonename:state:zonepath:uuid:brand:ip-type'.split(':')
    zone_data = __salt__['cmd.run_all']('zoneadm list -p -c')
    if zone_data['retcode'] == 0:
        for zone in zone_data['stdout'].splitlines():
            zone = zone.split(':')

            # create zone_t
            zone_t = {}
            for i in range(0, len(header)):
                zone_t[header[i]] = zone[i]

            # skip if global and hide_global
            if hide_global and zone_t['zonename'] == 'global':
                continue

            # skip installed and configured
            if not installed and zone_t['state'] == 'installed':
                continue
            if not configured and zone_t['state'] == 'configured':
                continue

            # update dict
            zones[zone_t['zonename']] = zone_t
            del zones[zone_t['zonename']]['zonename']

    return zones if verbose else sorted(zones.keys())