Skip to content

Commit

Permalink
Fix bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schulz committed Nov 6, 2020
1 parent 0a82f45 commit 3b5f228
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

import { ArchivePackage } from '../../../../common/types';
import { PackageInvalidArchiveError, PackageUnsupportedMediaTypeError } from '../../../errors';
import { cacheSet, setArchiveFilelist } from './cache';
import {
cacheSet,
cacheDelete,
getArchiveFilelist,
setArchiveFilelist,
deleteArchiveFilelist,
} from './cache';
import { ArchiveEntry, getBufferExtractor } from '../registry/extract';
import { parseAndVerifyArchive } from './validation';

Expand Down Expand Up @@ -66,3 +72,15 @@ export async function unpackArchiveToCache(
}
return paths;
}

export const deletePackageCache = (name: string, version: string) => {
// get cached archive filelist
const paths = getArchiveFilelist(name, version);

// delete cached archive filelist
deleteArchiveFilelist(name, version);

// delete cached archive files
// this has been populated in unpackRegistryPackageToCache()
paths?.forEach((path) => cacheDelete(path));
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { deletePipeline } from '../elasticsearch/ingest_pipeline/';
import { installIndexPatterns } from '../kibana/index_pattern/install';
import { deleteTransforms } from '../elasticsearch/transform/remove';
import { packagePolicyService, appContextService } from '../..';
import { splitPkgKey, deletePackageCache } from '../registry';
import { splitPkgKey } from '../registry';
import { deletePackageCache } from '../archive';

export async function removeInstallation(options: {
savedObjectsClient: SavedObjectsClientContract;
Expand Down

0 comments on commit 3b5f228

Please sign in to comment.