Update remove Vault resource contents if needed
542123
def sync(self, vault_client):
        """"""
        if self.present and not self.existing:
            LOG.info("Writing new %s to %s",
                     self.secret_format, self)
            self.write(vault_client)
        elif self.present and self.existing:
            if self.diff() == CHANGED or self.diff() == OVERWRITE:
                LOG.info("Updating %s in %s",
                         self.secret_format, self)
                self.write(vault_client)
        elif not self.present and not self.existing:
            LOG.info("No %s to remove from %s",
                     self.secret_format, self)
        elif not self.present and self.existing:
            LOG.info("Removing %s from %s",
                     self.secret_format, self)
            self.delete(vault_client)
721404
function removeThis()
    {
        $exportItems = $this->fetchItems();

        $db = eZDB::instance();
        $db->begin();
        foreach ( $exportItems as $item )
        {
            $item->remove();
        }
        $this->remove();
        $db->commit();
    }
104634
async def update_contents(self, **params):
		
		if params.get("message"):
			params = json.loads(params.get("message", "{}"))

		if not params:
			return {"error":400, "reason":"Missed required fields"}

		txid = params.get("txid")

		coinid = params.get("coinid").upper()

		try:
			coinid = coinid.replace("TEST", "")
		except:
			pass

		database = client[coinid]
		content_collection = database[settings.CONTENT]

		content = await content_collection.find_one({"txid":txid})

		if not content:
			return {"error":404, 
					"reason":"Update content. Content with txid %s not found" % txid}

		if content.get("hash"):
			self.account.blockchain.setendpoint(settings.bridges[coinid])
			cid = await self.account.blockchain.getcid(hash=content["hash"])

			await content_collection.find_one_and_update({"txid":txid}, {"$set":{"cid":int(cid)}})
			await content_collection.find_one_and_update({"txid":txid}, {"$set":{"hash":None}})


		updated = await content_collection.find_one({"txid":txid})

		return {i:updated[i] for i in updated if i != "_id"}
209208
def save_vault(self, vault_form, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinAdminSession.update_bin
        if vault_form.is_for_update():
            return self.update_vault(vault_form, *args, **kwargs)
        else:
            return self.create_vault(vault_form, *args, **kwargs)
1002212
static function removeEmpty()
    {
        $db = eZDB::instance();
        if ( $db->databaseName() == 'oracle' ) // fix for compatibility with Oracle versions prior to 9
            $query = 'SELECT eznotificationcollection.id FROM eznotificationcollection, eznotificationcollection_item
                      WHERE  eznotificationcollection.id = eznotificationcollection_item.collection_id(+) AND
                             eznotificationcollection_item.collection_id IS NULL';
        else
            $query = 'SELECT eznotificationcollection.id FROM eznotificationcollection
                      LEFT JOIN eznotificationcollection_item ON eznotificationcollection.id=eznotificationcollection_item.collection_id
                      WHERE eznotificationcollection_item.collection_id IS NULL';

        $idArray = $db->arrayQuery( $query );

        $db->begin();
        foreach ( $idArray as $id )
        {
            eZPersistentObject::removeObject( eZNotificationCollection::definition(), array( 'id' => $id['id'] ) );
        }
        $db->commit();
    }
202461
def update(collection_name, upsert, multi, spec,
           doc, safe, last_error_args, check_keys, opts, ctx=None):
    """"""
    if ctx:
        return _update_compressed(
            collection_name, upsert, multi, spec, doc, check_keys, opts, ctx)
    return _update_uncompressed(collection_name, upsert, multi, spec,
                                doc, safe, last_error_args, check_keys, opts)
650017
def cleanup(test_data, udfs, tmp_data, tmp_db):
    """"""
    con = make_ibis_client(ENV)

    if udfs:
        # this comes before test_data bc the latter clobbers this too
        con.hdfs.rmdir(os.path.join(ENV.test_data_dir, 'udf'))

    if test_data:
        con.drop_database(ENV.test_data_db, force=True)
        con.hdfs.rmdir(ENV.test_data_dir)

    if tmp_data:
        con.hdfs.rmdir(ENV.tmp_dir)

    if tmp_db:
        con.drop_database(ENV.tmp_db, force=True)
1124348
def diff(vault_client, opt):
    """"""
    if opt.thaw_from:
        opt.secrets = tempfile.mkdtemp('aomi-thaw')
        auto_thaw(vault_client, opt)

    ctx = Context.load(get_secretfile(opt), opt) \
                 .fetch(vault_client)

    for backend in ctx.mounts():
        diff_a_thing(backend, opt)

    for resource in ctx.resources():
        diff_a_thing(resource, opt)

    if opt.thaw_from:
        rmtree(opt.secrets)
697109
def _cleanup(self):
        '''
        
        '''
        if (hasattr(self, 'config')
           and self.config.get('support_archive')
           and os.path.exists(self.config['support_archive'])):
            self.out.warning('Terminated earlier, cleaning up')
            try:
                os.unlink(self.config['support_archive'])
            except Exception as err:
                log.debug(err)
                self.out.error('{} while cleaning up.'.format(err))
107726
function cleanupFsStorage(conf) {
    if (conf.cleanupStartup) {
        const storagePath = conf.storage,
              files = fs.readdirSync(storagePath);

        files.forEach((file) => {
            try {
                const filePath = utils.filePath(file, storagePath);
                fs.removeSync(filePath, {force: true});
            } catch (err) {}
        });
    }
}
1193432
def get_all
      raise yellow(
        "Vault prefix: '#{prefix}' does not exist, or doesn't contain any secrets to pull/check"\
        "\nEnsure mount is enabled and use `sanctum create`, and `sanctum push` to add secrets"
      ) if invalid_prefix?

      secrets_from_vault = Hash.new
      secrets_from_vault[prefix] = JSON(list_recursive(list_prefix).to_json)
      secrets_from_vault
    end
65610
def cleanup(self):
        
        if self.sock is not None:
            self.sock.close()
        if self.outfile is not None:
            self.outfile.close()
        if self.bar is not None:
            self.update_progress(complete=True)
1232882
public SecretBundle updateSecret(UpdateSecretRequest updateSecretRequest) {
        return updateSecret(updateSecretRequest.vaultBaseUrl(), updateSecretRequest.secretName(),
                updateSecretRequest.secretVersion(), updateSecretRequest.contentType(),
                updateSecretRequest.secretAttributes(), updateSecretRequest.tags());
    }
1271411
function Resource ( config, vault ) {
  if ( !config || !vault ) throw new Error('config and vault are required')
  this.config = _init( config, vault )
  this.vault = vault
  return this
}
1138681
def destroy(update_collection=true)
      return if new_record?
      previous_name = name_changed? ? name_was : name
      parent.modify_engine do |nat|
        nat.remove_redirect(previous_name)
      end
      parent_collection.delete(self, true) if parent_collection && update_collection
      new_record!
      true
    end
559460
def update_generic_password(client, path):
    """"""
    vault_path, key = path_pieces(path)
    mount = mount_for_path(vault_path, client)
    if not mount:
        client.revoke_self_token()
        raise aomi.exceptions.VaultConstraint('invalid path')

    if backend_type(mount, client) != 'generic':
        client.revoke_self_token()
        raise aomi.exceptions.AomiData("Unsupported backend type")

    LOG.debug("Updating generic password at %s", path)
    existing = client.read(vault_path)
    if not existing or 'data' not in existing:
        LOG.debug("Nothing exists yet at %s!", vault_path)
        existing = {}
    else:
        LOG.debug("Updating %s at %s", key, vault_path)
        existing = existing['data']

    new_password = get_password()
    if key in existing and existing[key] == new_password:
        client.revoke_self_token()
        raise aomi.exceptions.AomiData("Password is same as existing")

    existing[key] = new_password
    client.write(vault_path, **existing)
169642
def cleanup(bucket, prefix, versions)
      objects = @con.get_bucket(bucket, :prefix => prefix).body['Contents']

      return if objects.size <= versions

      objects[0...(objects.size - versions)].each do |o|
       Mongolicious.logger.info("Removing outdated version #{o['Key']}")
       @con.delete_object(bucket, o['Key'])
      end
    end