mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Security Solutions][Endpoint] Use id instead of identifier to get fleet artifact (#154810)
## Summary Get fleet artifacts by `artifact.id` instead of by `artifact.identifier` before pushing them to the endpoint manifest. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
22015b470f
commit
fbe024306c
1 changed files with 8 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
|||
import pMap from 'p-map';
|
||||
import semver from 'semver';
|
||||
import type LRU from 'lru-cache';
|
||||
import { isEqual, isEmpty, keyBy } from 'lodash';
|
||||
import { isEqual, isEmpty } from 'lodash';
|
||||
import { type Logger, type SavedObjectsClientContract } from '@kbn/core/server';
|
||||
import {
|
||||
ENDPOINT_EVENT_FILTERS_LIST_ID,
|
||||
|
@ -365,11 +365,15 @@ export class ManifestManager {
|
|||
}
|
||||
|
||||
if (fleetArtifacts) {
|
||||
const fleetArtfactsByIdentifier = keyBy(fleetArtifacts, 'identifier');
|
||||
const fleetArtfactsByIdentifier: { [key: string]: InternalArtifactCompleteSchema } = {};
|
||||
fleetArtifacts.forEach((fleetArtifact) => {
|
||||
fleetArtfactsByIdentifier[getArtifactId(fleetArtifact)] = fleetArtifact;
|
||||
});
|
||||
artifactsToCreate.forEach((artifact) => {
|
||||
const fleetArtifact = fleetArtfactsByIdentifier[artifact.identifier];
|
||||
if (!fleetArtifact) return;
|
||||
const artifactId = getArtifactId(artifact);
|
||||
const fleetArtifact = fleetArtfactsByIdentifier[artifactId];
|
||||
|
||||
if (!fleetArtifact) return;
|
||||
// Cache the compressed body of the artifact
|
||||
this.cache.set(artifactId, Buffer.from(artifact.body, 'base64'));
|
||||
newManifest.replaceArtifact(fleetArtifact);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue