diff --git a/x-pack/plugins/security_solution/server/endpoint/services/fleet/endpoint_fleet_services_factory.ts b/x-pack/plugins/security_solution/server/endpoint/services/fleet/endpoint_fleet_services_factory.ts index af7d33700ef29..c993428b047e7 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/fleet/endpoint_fleet_services_factory.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/fleet/endpoint_fleet_services_factory.ts @@ -261,10 +261,10 @@ const fetchEndpointPolicyNamespace = async ({ } for (const integrationPolicyId of integrationPolicies) { - response.integrationPolicy[integrationPolicyId] = retrievedIntegrationPolicies[ - integrationPolicyId - ].namespace - ? [retrievedIntegrationPolicies[integrationPolicyId].namespace] + const integrationPolicyNamespace = retrievedIntegrationPolicies[integrationPolicyId].namespace; + + response.integrationPolicy[integrationPolicyId] = integrationPolicyNamespace + ? [integrationPolicyNamespace] : retrievedIntegrationPolicies[integrationPolicyId].policy_ids.map((agentPolicyId) => { return retrievedAgentPolicies[agentPolicyId].namespace; }); diff --git a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts index 2807ae9482891..80337d1a927b8 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts @@ -97,7 +97,8 @@ jest.mock('./handlers/create_policy_datastreams', () => { }; }); -const createPolicyDataStreamsIfNeededMock = _createPolicyDataStreamsIfNeeded as jest.Mock; +const createPolicyDataStreamsIfNeededMock = + _createPolicyDataStreamsIfNeeded as unknown as jest.Mock; describe('Fleet integrations', () => { let endpointAppContextStartContract: EndpointAppContextServiceStartContract; diff --git a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts index 4c3f6dd75a46d..54f1ce8cc7e01 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts @@ -326,7 +326,7 @@ export const getPackagePolicyPostUpdateCallback = ( createPolicyDataStreamsIfNeeded({ endpointServices, endpointPolicyIds: [packagePolicy.id], - }); + }).catch(() => {}); // to silence @typescript-eslint/no-floating-promises return packagePolicy; }; @@ -349,7 +349,7 @@ export const getPackagePolicyPostCreateCallback = ( createPolicyDataStreamsIfNeeded({ endpointServices, endpointPolicyIds: [packagePolicy.id], - }); + }).catch(() => {}); // to silence @typescript-eslint/no-floating-promises const integrationConfig = packagePolicy?.inputs[0]?.config?.integration_config; @@ -434,7 +434,7 @@ export const getAgentPolicyPostUpdateCallback = ( createPolicyDataStreamsIfNeeded({ endpointServices, endpointPolicyIds: [endpointPolicy.id], - }); + }).catch(() => {}); // to silence @typescript-eslint/no-floating-promises return agentPolicy; };