def uninstalled(name):
    '''
    Ensure zone is uninstalled

    name : string
        name of the zone

    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    zones = __salt__['zoneadm.list'](installed=True, configured=True)
    if name in zones:
        if zones[name]['state'] != 'configured':
            if __opts__['test']:
                res_uninstall = {'status': True}
            else:
                res_uninstall = __salt__['zoneadm.uninstall'](name)
            ret['result'] = res_uninstall['status']
            if ret['result']:
                ret['changes'][name] = 'uninstalled'
                ret['comment'] = 'The zone {0} was uninstalled.'.format(name)
            else:
                ret['comment'] = []
                ret['comment'].append('Failed to uninstall zone {0}!'.format(name))
                if 'message' in res_uninstall:
                    ret['comment'].append(res_uninstall['message'])
                ret['comment'] = "\n".join(ret['comment'])
        else:
            ret['result'] = True
            ret['comment'] = 'zone {0} already uninstalled.'.format(name)
    else:
        ## note: a non existing zone is not installed, we do not consider this a failure
        ret['result'] = True
        ret['comment'] = 'zone {0} is not configured!'.format(name)

    return ret
def uninstalled ( name ) : ret = { 'name' : name , 'changes' : { } , 'result' : None , 'comment' : '' } zones = __salt__ [ 'zoneadm.list' ] ( installed = True , configured = True ) if name in zones : if zones [ name ] [ 'state' ] != 'configured' : if __opts__ [ 'test' ] : res_uninstall = { 'status' : True } else : res_uninstall = __salt__ [ 'zoneadm.uninstall' ] ( name ) ret [ 'result' ] = res_uninstall [ 'status' ] if ret [ 'result' ] : ret [ 'changes' ] [ name ] = 'uninstalled' ret [ 'comment' ] = 'The zone {0} was uninstalled.' . format ( name ) else : ret [ 'comment' ] = [ ] ret [ 'comment' ] . append ( 'Failed to uninstall zone {0}!' . format ( name ) ) if 'message' in res_uninstall : ret [ 'comment' ] . append ( res_uninstall [ 'message' ] ) ret [ 'comment' ] = "\n" . join ( ret [ 'comment' ] ) else : ret [ 'result' ] = True ret [ 'comment' ] = 'zone {0} already uninstalled.' . format ( name ) else : ret [ 'result' ] = True ret [ 'comment' ] = 'zone {0} is not configured!' . format ( name ) return ret
Ensure zone is uninstalled

    name : string
        name of the zone