Ensure that a network is absent.

    name
        Name of the network

    Usage Example:

    .. code-block:: yaml

        network_foo:
          docker_network.absent
196071
def absent(name):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': False,
           'comment': ''}

    try:
        network = __salt__['docker.inspect_network'](name)
    except CommandExecutionError as exc:
        msg = exc.__str__()
        if '404' in msg:
            # Network not present
            network = None
        else:
            ret['comment'] = msg
            return ret

    if network is None:
        ret['result'] = True
        ret['comment'] = 'Network \'{0}\' already absent'.format(name)
        return ret

    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Network \'{0}\' will be removed'.format(name)
        return ret

    return _remove_network(network)
486746
def vm_absent(name, archive=False):
    '''
    

    '''
    name = name.lower()
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    if name not in __salt__['vmadm.list'](order='hostname'):
        # we're good
        ret['result'] = True
        ret['comment'] = 'vm {0} is absent'.format(name)
    else:
        # delete vm
        if not __opts__['test']:
            # set archive to true if needed
            if archive:
                __salt__['vmadm.update'](vm=name, key='hostname', archive_on_delete=True)

            ret['result'] = __salt__['vmadm.delete'](name, key='hostname')
        else:
            ret['result'] = True

        if not isinstance(ret['result'], bool) and ret['result'].get('Error'):
            ret['result'] = False
            ret['comment'] = 'failed to delete vm {0}'.format(name)
        else:
            ret['comment'] = 'vm {0} deleted'.format(name)
            ret['changes'][name] = None

    return ret
763904
def ip_cmd(self, name):
        
        if not self.container_exists(name=name):
            exit('Unknown container {0}'.format(name))

        ip = self.get_container_ip(name)
        if not ip:
            exit("Failed to get network address for"
                 " container {0}".format(name))
        else:
            echo(ip)
891904
def absent(name,
           runas=None):
    '''
    
    '''
    ret = {'name': name, 'result': False, 'comment': '', 'changes': {}}

    try:
        user_exists = __salt__['rabbitmq.user_exists'](name, runas=runas)
    except CommandExecutionError as err:
        ret['comment'] = 'Error: {0}'.format(err)
        return ret

    if user_exists:
        if not __opts__['test']:
            try:
                __salt__['rabbitmq.delete_user'](name, runas=runas)
            except CommandExecutionError as err:
                ret['comment'] = 'Error: {0}'.format(err)
                return ret
        ret['changes'].update({'name':
                              {'old': name,
                               'new': ''}})
    else:
        ret['result'] = True
        ret['comment'] = 'The user \'{0}\' is not present.'.format(name)
        return ret

    if __opts__['test'] and ret['changes']:
        ret['result'] = None
        ret['comment'] = 'The user \'{0}\' will be removed.'.format(name)
        return ret

    ret['result'] = True
    ret['comment'] = 'The user \'{0}\' was removed.'.format(name)
    return ret
110116
def absent(name, auth=None, **kwargs):
    '''
    
    '''
    rule_id = kwargs['rule_id']
    ret = {'name': rule_id,
           'changes': {},
           'result': True,
           'comment': ''}

    __salt__['neutronng.setup_clouds'](auth)

    secgroup = __salt__['neutronng.security_group_get'](
        name=name,
        filters={'tenant_id': kwargs['project_id']}
    )

    # no need to delete a rule if the security group doesn't exist
    if secgroup is None:
        ret['comment'] = "security group does not exist"
        return ret

    # This should probably be done with compare on fields instead of
    # rule_id in the future
    rule_exists = None
    for rule in secgroup['security_group_rules']:
        if _rule_compare(rule, {"id": rule_id}) is True:
            rule_exists = True

    if rule_exists:
        if __opts__['test']:
            ret['result'] = None
            ret['changes'] = {'id': kwargs['rule_id']}
            ret['comment'] = 'Security group rule will be deleted.'
            return ret

        __salt__['neutronng.security_group_rule_delete'](rule_id=rule_id)
        ret['changes']['id'] = rule_id
        ret['comment'] = 'Deleted security group rule'

    return ret
1253427
def object_absent(container, name, profile):
    '''
    
    '''
    existing_object = __salt__['libcloud_storage.get_container_object'](container, name, profile)
    if existing_object is None:
        return state_result(True, "Object already absent", name, {})
    else:
        result = __salt__['libcloud_storage.delete_object'](container, name, profile)
        return state_result(result, "Deleted object", name, {})
189252
def absent(name):
    '''
    

    '''

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

    # Comment and change messages
    comment_bridge_deleted = 'Bridge {0} deleted.'.format(name)
    comment_bridge_notdeleted = 'Unable to delete bridge: {0}.'.format(name)
    comment_bridge_notexists = 'Bridge {0} does not exist.'.format(name)
    changes_bridge_deleted = {name: {'old': 'Bridge {0} exists.'.format(name),
                                     'new': 'Bridge {0} deleted.'.format(name),
                                     }
                              }

    bridge_exists = __salt__['openvswitch.bridge_exists'](name)

    # Dry run, test=true mode
    if __opts__['test']:
        if not bridge_exists:
            ret['result'] = True
            ret['comment'] = comment_bridge_notexists
        else:
            ret['result'] = None
            ret['comment'] = comment_bridge_deleted

        return ret

    if not bridge_exists:
        ret['result'] = True
        ret['comment'] = comment_bridge_notexists
    else:
        bridge_delete = __salt__['openvswitch.bridge_delete'](name)
        if bridge_delete:
            ret['result'] = True
            ret['comment'] = comment_bridge_deleted
            ret['changes'] = changes_bridge_deleted
        else:
            ret['result'] = False
            ret['comment'] = comment_bridge_notdeleted

    return ret
163612
def absent(name, profile='grafana'):
    '''
    
    '''
    if isinstance(profile, string_types):
        profile = __salt__['config.option'](profile)

    ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
    org = __salt__['grafana4.get_org'](name, profile)

    if not org:
        ret['result'] = True
        ret['comment'] = 'Org {0} already absent'.format(name)
        return ret

    if __opts__['test']:
        ret['comment'] = 'Org {0} will be deleted'.format(name)
        return ret
    __salt__['grafana4.delete_org'](org['id'], profile=profile)

    ret['result'] = True
    ret['changes'][name] = 'Absent'
    ret['comment'] = 'Org {0} was deleted'.format(name)

    return ret
1216155
def absent(name, provider):
    '''
    
    '''
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

    is_present = list(__salt__['cloud.action']('queues_exists', provider=provider, name=name)[provider].values())[0]

    if is_present:
        if __opts__['test']:
            ret['comment'] = 'Rackspace queue {0} is set to be removed.'.format(
                name)
            ret['result'] = None
            return ret
        queue = __salt__['cloud.action']('queues_show', provider=provider, name=name)
        deleted = __salt__['cloud.action']('queues_delete', provider=provider, name=name)
        if deleted:
            ret['changes']['old'] = queue
            ret['changes']['new'] = {}
        else:
            ret['result'] = False
            ret['comment'] = 'Failed to delete {0} Rackspace queue.'.format(name)
    else:
        ret['comment'] = '{0} does not exist.'.format(name)

    return ret
519981
def absent(name):
    '''
    
    '''

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

    try:
        index = __salt__['elasticsearch.index_get'](index=name)
        if index and name in index:
            if __opts__['test']:
                ret['comment'] = 'Index {0} will be removed'.format(name)
                ret['changes']['old'] = index[name]
                ret['result'] = None
            else:
                ret['result'] = __salt__['elasticsearch.index_delete'](index=name)
                if ret['result']:
                    ret['comment'] = 'Successfully removed index {0}'.format(name)
                    ret['changes']['old'] = index[name]
                else:
                    ret['comment'] = 'Failed to remove index {0} for unknown reasons'.format(name)
        else:
            ret['comment'] = 'Index {0} is already absent'.format(name)
    except Exception as err:
        ret['result'] = False
        ret['comment'] = six.text_type(err)

    return ret
1193739
def jdbc_datasource_absent(name, both=True, server=None):
    '''
    
    '''
    ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
    pool_ret = _do_element_absent(name, 'jdbc_connection_pool', {'cascade': both}, server)

    if not pool_ret['error']:
        if __opts__['test'] and pool_ret['delete']:
            ret['comment'] = 'JDBC Datasource set to be deleted'
        elif pool_ret['delete']:
            ret['result'] = True
            ret['comment'] = 'JDBC Datasource deleted'
        else:
            ret['result'] = True
            ret['comment'] = 'JDBC Datasource doesn\'t exist'
    else:
        ret['result'] = False
        ret['comment'] = 'Error: {0}'.format(pool_ret['error'])
    return ret
1204718
def absent(name, auth=None):
    '''
    

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

    __salt__['neutronng.setup_clouds'](auth)

    subnet = __salt__['neutronng.subnet_get'](name=name)

    if subnet:
        if __opts__['test'] is True:
            ret['result'] = None
            ret['changes'] = {'id': subnet.id}
            ret['comment'] = 'Project will be deleted.'
            return ret

        __salt__['neutronng.subnet_delete'](name=subnet)
        ret['changes']['id'] = name
        ret['comment'] = 'Deleted subnet'

    return ret
40289
def absent(name, auth=None, **kwargs):
    '''
    

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

    kwargs = __utils__['args.clean_kwargs'](**kwargs)

    __salt__['neutronng.setup_clouds'](auth)

    kwargs['project_id'] = __salt__['keystoneng.project_get'](
        name=kwargs['project_name'])

    secgroup = __salt__['neutronng.security_group_get'](
        name=name,
        filters={'project_id': kwargs['project_id']}
    )

    if secgroup:
        if __opts__['test'] is True:
            ret['result'] = None
            ret['changes'] = {'id': secgroup.id}
            ret['comment'] = 'Security group will be deleted.'
            return ret

        __salt__['neutronng.security_group_delete'](name=secgroup)
        ret['changes']['id'] = name
        ret['comment'] = 'Deleted security group'

    return ret
566580
def absent(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

    exists = __salt__['boto_elb.exists'](name, region, key, keyid, profile)
    if exists:
        if __opts__['test']:
            ret['comment'] = 'ELB {0} is set to be removed.'.format(name)
            ret['result'] = None
            return ret
        deleted = __salt__['boto_elb.delete'](name, region, key, keyid,
                                              profile)
        if deleted:
            ret['changes']['old'] = {'elb': name}
            ret['changes']['new'] = {'elb': None}
            ret['comment'] = 'ELB {0} deleted.'.format(name)
        else:
            ret['result'] = False
            ret['comment'] = 'Failed to delete {0} ELB.'.format(name)
    else:
        ret['comment'] = '{0} ELB does not exist.'.format(name)
    return ret
1084120
def absent(name, user=None, signal=None):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': False,
           'comment': ''}

    if __opts__['test']:
        running = __salt__['ps.pgrep'](name, user=user)
        ret['result'] = None
        if running:
            ret['comment'] = ('{0} processes will '
                              'be killed').format(len(running))
        else:
            ret['comment'] = 'No matching processes running'
        return ret

    if signal:
        status = __salt__['ps.pkill'](name, user=user,
                                      signal=signal, full=True)
    else:
        status = __salt__['ps.pkill'](name, user=user, full=True)

    ret['result'] = True
    if status:
        ret['comment'] = 'Killed {0} processes'.format(len(status['killed']))
        ret['changes'] = status
    else:
        ret['comment'] = 'No matching processes running'
    return ret
713590
def user_absent(name, profile=None, **connection_args):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'User "{0}" is already absent'.format(name)}

    # Check if user is present
    user = __salt__['keystone.user_get'](name=name, profile=profile,
                                         **connection_args)
    if 'Error' not in user:
        if __opts__.get('test'):
            ret['result'] = None
            ret['comment'] = 'User "{0}" will be deleted'.format(name)
            return ret
        # Delete that user!
        __salt__['keystone.user_delete'](name=name, profile=profile,
                                         **connection_args)
        ret['comment'] = 'User "{0}" has been deleted'.format(name)
        ret['changes']['User'] = 'Deleted'

    return ret
964509
def absent(name, poll=5, timeout=60, profile=None):
    '''
    

    '''
    log.debug('Absent with (%s, %s %s)', name, poll, profile)
    ret = {'name': None,
           'comment': '',
           'changes': {},
           'result': True}
    if not name:
        ret['result'] = False
        ret['comment'] = 'Name ist not valid'
        return ret

    ret['name'] = name,

    existing_stack = __salt__['heat.show_stack'](name, profile=profile)

    if not existing_stack['result']:
        ret['result'] = True
        ret['comment'] = 'Stack not exist'
        return ret
    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Stack {0} is set to be removed'.format(name)
        return ret

    stack = __salt__['heat.delete_stack'](name=name, poll=poll,
                                          timeout=timeout, profile=profile)

    ret['result'] = stack['result']
    ret['comment'] = stack['comment']
    ret['changes']['stack_name'] = name
    ret['changes']['comment'] = 'Delete stack'
    return ret