Ensure key absent from redis

    name
        Key to ensure absent from redis

    keys
        list of keys to ensure absent, name will be ignored if this is used
966709
def absent(name, keys=None, **connection_args):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'Key(s) specified already absent'}

    if keys:
        if not isinstance(keys, list):
            ret['result'] = False
            ret['comment'] = '`keys` not formed as a list type'
            return ret
        delete_list = [key for key in keys
                       if __salt__['redis.exists'](key, **connection_args)]
        if not delete_list:
            return ret
        __salt__['redis.delete'](*delete_list, **connection_args)
        ret['changes']['deleted'] = delete_list
        ret['comment'] = 'Keys deleted'
        return ret

    if __salt__['redis.exists'](name, **connection_args):
        __salt__['redis.delete'](name, **connection_args)
        ret['comment'] = 'Key deleted'
        ret['changes']['deleted'] = [name]
    return ret
95475
def absent(name, protocol=None, service_address=None):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}

    #check if service exists and remove it
    service_check = __salt__['lvs.check_service'](protocol=protocol,
                                                  service_address=service_address)
    if service_check is True:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'LVS Service {0} is present and needs to be removed'.format(name)
            return ret
        service_delete = __salt__['lvs.delete_service'](protocol=protocol,
                                                        service_address=service_address)
        if service_delete is True:
            ret['comment'] = 'LVS Service {0} has been removed'.format(name)
            ret['changes'][name] = 'Absent'
            return ret
        else:
            ret['comment'] = 'LVS Service {0} removed failed({1})'.format(name, service_delete)
            ret['result'] = False
            return ret
    else:
        ret['comment'] = 'LVS Service {0} is not present, so it cannot be removed'.format(name)

    return ret
455043
def keys(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
      return redis(&:keys) if pattern.nil?

      redis { |conn| conn.scan_each(match: prefix(pattern), count: count).to_a }
    end
676817
def absent(name, auth=None):
    '''
    
    '''

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

    __salt__['keystoneng.setup_clouds'](auth)

    service = __salt__['keystoneng.service_get'](name=name)

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

        __salt__['keystoneng.service_delete'](name=service)
        ret['changes']['id'] = service.id
        ret['comment'] = 'Deleted service'

    return ret
446633
def absent(name=None, canonical=None, **api_opts):
    '''
    
    '''
    ret = {'name': name, 'result': False, 'comment': '', 'changes': {}}
    obj = __salt__['infoblox.get_cname'](name=name, canonical=canonical, **api_opts)

    if not obj:
        ret['result'] = True
        ret['comment'] = 'infoblox already removed'
        return ret

    if __opts__['test']:
        ret['result'] = None
        ret['changes'] = {'old': obj, 'new': 'absent'}
        return ret

    if __salt__['infoblox.delete_cname'](name=name, canonical=canonical, **api_opts):
        ret['result'] = True
        ret['changes'] = {'old': obj, 'new': 'absent'}
    return ret
283018
def ensureKeysAreSetup(self):
        
        if not areKeysSetup(self.name, self.keys_dir):
            raise REx(REx.reason.format(self.name) + self.keygenScript)
922641
def absent(name, exports='/etc/exports'):
    '''
    
    '''

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

    old = __salt__['nfs3.list_exports'](exports)
    if path in old:
        if __opts__['test']:
            ret['comment'] = 'Export {0} would be removed'.format(path)
            ret['changes'][path] = old[path]
            ret['result'] = None
            return ret

        __salt__['nfs3.del_export'](exports, path)
        try_reload = __salt__['nfs3.reload_exports']()
        if not try_reload['result']:
            ret['comment'] = try_reload['stderr']
        else:
            ret['comment'] = 'Export {0} removed'.format(path)

        ret['result'] = try_reload['result']
        ret['changes'][path] = old[path]
    else:
        ret['comment'] = 'Export {0} already absent'.format(path)
        ret['result'] = True

    return ret
762386
def absent(name, ip):  # pylint: disable=C0103
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    if not isinstance(ip, list):
        ip = [ip]

    comments = []
    for _ip in ip:
        if not __salt__['hosts.has_pair'](_ip, name):
            ret['result'] = True
            comments.append('Host {0} ({1}) already absent'.format(name, _ip))
        else:
            if __opts__['test']:
                comments.append('Host {0} ({1}) needs to be removed'.format(name, _ip))
            else:
                if __salt__['hosts.rm_host'](_ip, name):
                    ret['changes'] = {'host': name}
                    ret['result'] = True
                    comments.append('Removed host {0} ({1})'.format(name, _ip))
                else:
                    ret['result'] = False
                    comments.append('Failed to remove host')
    ret['comment'] = '\n'.join(comments)
    return ret
1154553
def missing_hash_entries(the_hash, *keys)
    # Support passing either an Array or multiple args:
    if keys.size == 1 && keys.first.is_a?(Array)
      keys = keys.first
    end

    keys - the_hash.keys
  end
1108440
private void verifyKey(final String key) {

		if (!theKey.get().equals(key)) {
			try {
				throw new RuntimeException("Must have same key for Redis Pipeline in Dynomite. This key: " + key);
			} finally {
				discardPipelineAndReleaseConnection();
			}
		}
	}
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
466635
def key_list(items=None):
    '''
    
    '''
    if items is None:
        items = []

    ret = {}
    if items and isinstance(items, list):
        for item in items:
            if 'name' in item:
                # added for consistency with old code
                if 'id' not in item:
                    item['id'] = item['name']
                ret[item['name']] = item
    return ret
569653
def delete(self, *names):
        
        names = [self.redis_key(n) for n in names]
        with self.pipe as pipe:
            return pipe.delete(*names)
77093
def clean_key_name(self):
        """"""
        key = self.cleaned_data['key_name']
        # Ensure key starts with prefix
        if not key.startswith(self.get_key_prefix()):
            raise forms.ValidationError('Key does not have required prefix.')
        # Ensure key exists
        if not self.get_upload_key():
            raise forms.ValidationError('Key does not exist.')
        return key
789870
def clean_buckets(self, hash_name):
        
        bucket_keys = self._iter_bucket_keys(hash_name)
        self.redis_object.delete(*bucket_keys)
926217
def method_missing(name)
      return response[name.to_s] if has_key?(name.to_s)
      super.method_missing name
    end
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