Adds an RDS instance to the inventory and index, as long as it is
        addressable
960868
def add_rds_instance(self, instance, region):
        '''  '''

        # Only want available instances unless all_rds_instances is True
        if not self.all_rds_instances and instance.status != 'available':
            return

        # Select the best destination address
        dest = instance.endpoint[0]

        if not dest:
            # Skip instances we cannot address (e.g. private VPC subnet)
            return

        # Add to index
        self.index[dest] = [region, instance.id]

        # Inventory: Group by instance ID (always a group of 1)
        if self.group_by_instance_id:
            self.inventory[instance.id] = [dest]
            if self.nested_groups:
                self.push_group(self.inventory, 'instances', instance.id)

        # Inventory: Group by region
        if self.group_by_region:
            self.push(self.inventory, region, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'regions', region)

        # Inventory: Group by availability zone
        if self.group_by_availability_zone:
            self.push(self.inventory, instance.availability_zone, dest)
            if self.nested_groups:
                if self.group_by_region:
                    self.push_group(self.inventory, region, instance.availability_zone)
                self.push_group(self.inventory, 'zones', instance.availability_zone)

        # Inventory: Group by instance type
        if self.group_by_instance_type:
            type_name = self.to_safe('type_' + instance.instance_class)
            self.push(self.inventory, type_name, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'types', type_name)

        # Inventory: Group by VPC
        if self.group_by_vpc_id and instance.subnet_group and instance.subnet_group.vpc_id:
            vpc_id_name = self.to_safe('vpc_id_' + instance.subnet_group.vpc_id)
            self.push(self.inventory, vpc_id_name, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'vpcs', vpc_id_name)

        # Inventory: Group by security group
        if self.group_by_security_group:
            try:
                if instance.security_group:
                    key = self.to_safe("security_group_" + instance.security_group.name)
                    self.push(self.inventory, key, dest)
                    if self.nested_groups:
                        self.push_group(self.inventory, 'security_groups', key)

            except AttributeError:
                self.fail_with_error('\n'.join(['Package boto seems a bit older.', 
                                            'Please upgrade boto >= 2.3.0.']))


        # Inventory: Group by engine
        if self.group_by_rds_engine:
            self.push(self.inventory, self.to_safe("rds_" + instance.engine), dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'rds_engines', self.to_safe("rds_" + instance.engine))

        # Inventory: Group by parameter group
        if self.group_by_rds_parameter_group:
            self.push(self.inventory, self.to_safe("rds_parameter_group_" + instance.parameter_group.name), dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'rds_parameter_groups', self.to_safe("rds_parameter_group_" + instance.parameter_group.name))

        # Global Tag: all RDS instances
        self.push(self.inventory, 'rds', dest)

        self.inventory["_meta"]["hostvars"][dest] = self.get_host_info_dict_from_instance(instance)
285179
def create_index(self, index):
    

    index._path = os.path.join(self.indexes_path, index._name)

    if whoosh.index.exists_in(index._path):
      _whoosh = whoosh.index.open_dir(index._path)
    elif not os.path.exists(index._path):
      os.makedirs(index._path)
      _whoosh = whoosh.index.create_in(index._path, index._schema)
    index._whoosh = _whoosh
1175462
def _add(self, command, *args, **kwargs):
        
        if self.indexable:
            self.index(args)
        return self._traverse_command(command, *args, **kwargs)
1266628
def _add_to_indices(self, pipeline):
        """"""
        for att in self.indices:
            self._add_to_index(att, pipeline=pipeline)
298870
def Inventory(cls):
        
        l = ServerSet()
        rs = cls.find()
        for server in rs:
            l.append(server)
        return l
691495
def create_disconnected_rds(new_rds_name = nil)
      @new_rds_id = new_rds_name if new_rds_name
      prepare_backup unless @original_server  # in case run as a convenience method
      snapshot_original_rds
      create_tmp_rds_from_snapshot
      configure_tmp_rds
      wait_for_new_security_group
      wait_for_new_parameter_group # (reboots as needed)
      destroy_snapshot
    end
156499
def prepare_backup
      unless @original_server = RDSBackup.get_rds(rds_id)
        names = RDSBackup.rds_accounts.map {|name, account| name }
        raise "Unable to find RDS #{rds_id} in accounts #{names.join ", "}"
      end
      @account_name = @original_server.tracker_account[:name]
      @rds = ::Fog::AWS::RDS.new(
        RDSBackup.rds_accounts[@account_name][:credentials])
      @snapshot         = @rds.snapshots.get @snapshot_id
      @new_instance     = @rds.servers.get @new_rds_id
    end
942475
def _add_to_index(index, obj):
    """"""
    id_set = index.value_map.setdefault(indexed_value(index, obj), set())
    if index.unique:
        if len(id_set) > 0:
            raise UniqueConstraintError()
    id_set.add(obj.id)
880490
def put_mapping(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.put_mapping(index=self._name, **kwargs)
790768
def add_index(columns, index_name = nil)
      options = { name: index_name } if index_name
      migration.add_index(table_name, columns, options || {})
    end
10093
def add(self, *args, **kwargs):
        

        check_uniqueness = kwargs.get('check_uniqueness', True)

        key = self.get_storage_key(*args)
        if self.field.unique and check_uniqueness:
            self.check_uniqueness(key=key, *args)

        # Do index => create a key to be able to retrieve parent pk with
        # current field value]
        pk = self.instance.pk.get()
        logger.debug("adding %s to index %s" % (pk, key))
        self.connection.sadd(key, pk)
        self._indexed_values.add(tuple(args))
690190
def add_index(self, mode, blob_id, path):
        
        self.command_exec(['update-index', '--add', '--cacheinfo', mode, blob_id, path])
1106398
def setup_db(self, wait_for_ready=True):
        ''' 
        '''

        if self.es.indices.exists(self.index_name):
            try:
                self.update_mappings()
            except MappingsException as ex:
                log.error(ex)
                log.warn('An old or wrong properties mapping has been found for index: "{0}",\
                          this could led to some errors. It is recomanded to run "libreant-db upgrade"'.format(self.index_name))
        else:
            log.debug("Index is missing: '{0}'".format(self.index_name))
            self.create_index()

        if wait_for_ready:
            log.debug('waiting for index "{}" to be ready'.format(self.index_name))
            self.es.cluster.health(index=self.index_name, level='index', wait_for_status='yellow')
            log.debug('index "{}" is now ready'.format(self.index_name))
1029839
def create_index(self, index, index_type=GEO2D):
        
        self.logger.info("Adding %s index to stores on attribute: %s" % (index_type, index))
        yield self.collection.create_index([(index, index_type)])
1307796
def load_inventory(hosts_file=HOSTS_FILE):
    '''
    '''
    inventory = SafeConfigParser(allow_no_value=True)
    if os.path.exists(hosts_file):
        inventory.read(hosts_file)
    else:
        logger.warn('inventory file doesn\'t exist: %s', hosts_file)
    return inventory
615396
public void setTaskInstanceIndices(Long taskInstId, Map<String,String> indices)
            throws DataAccessException {
        try {
            db.openConnection();
            // delete existing indices
            String query = "delete from INSTANCE_INDEX where INSTANCE_ID=? and OWNER_TYPE='TASK_INSTANCE'";
            // insert new ones
            db.runUpdate(query, taskInstId);
            query = "insert into INSTANCE_INDEX " +
                    "(INSTANCE_ID,OWNER_TYPE,INDEX_KEY,INDEX_VALUE,CREATE_DT) values (?,'TASK_INSTANCE',?,?,"+now()+")";
            db.prepareStatement(query);
            Object[] args = new Object[3];
            args[0] = taskInstId;
            for (String key : indices.keySet()) {
                args[1] = key;
                args[2] = indices.get(key);
                if (!StringHelper.isEmpty((String)args[2])) db.runUpdateWithPreparedStatement(args);
            }
            db.commit();
        } catch (Exception e) {
            db.rollback();
            throw new DataAccessException(0,"failed to add task instance indices", e);
        } finally {
            db.closeConnection();
        }
    }
133518
def addResource(self, pid):
        
        self._check_initialized()
        try:
            # is entry already in place?
            self.getObjectByPid(pid)
            return
        except IndexError:
            pass
        # Entry not present, add it to the graph
        oid = self._pid_to_id(pid)
        obj = rdflib.URIRef(oid)
        ag = self.getAggregation()
        self.add((ag, ORE.aggregates, obj))
        self.add((obj, ORE.isAggregatedBy, ag))
        self.add((obj, DCTERMS.identifier, rdflib.term.Literal(pid)))