From 5b44541bd9acd0ff5e5284c1370ed1d1780ad046 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Mon, 1 Nov 2021 15:38:18 -0400 Subject: [PATCH] [7.15] [Fleet] Fix pipeline with id [*] does not exists (#116707) (#116942) * [Fleet] Fix pipeline with id [*] does not exists (#116707) # Conflicts: # x-pack/test/fleet_api_integration/apis/epm/install_by_upload.ts * Fix tests --- .../plugins/fleet/server/services/epm/archive/storage.ts | 2 +- .../fleet/server/services/epm/archive/validation.ts | 3 +-- .../apis/epm/__snapshots__/install_by_upload.snap | 7 ++----- .../fleet_api_integration/apis/epm/install_by_upload.ts | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/fleet/server/services/epm/archive/storage.ts b/x-pack/plugins/fleet/server/services/epm/archive/storage.ts index d3bc4afae6229..6740c24295c5c 100644 --- a/x-pack/plugins/fleet/server/services/epm/archive/storage.ts +++ b/x-pack/plugins/fleet/server/services/epm/archive/storage.ts @@ -256,7 +256,7 @@ export const getEsPackage = async ( dataStreams.push({ dataset: dataset || `${pkgName}.${dataStreamPath}`, package: pkgName, - ingest_pipeline: ingestPipeline || 'default', + ingest_pipeline: ingestPipeline, path: dataStreamPath, streams, ...dataStreamManifestProps, diff --git a/x-pack/plugins/fleet/server/services/epm/archive/validation.ts b/x-pack/plugins/fleet/server/services/epm/archive/validation.ts index c530c61d0a8f7..a46a26738bdab 100644 --- a/x-pack/plugins/fleet/server/services/epm/archive/validation.ts +++ b/x-pack/plugins/fleet/server/services/epm/archive/validation.ts @@ -217,7 +217,6 @@ export function parseAndVerifyDataStreams( } const streams = parseAndVerifyStreams(manifestStreams, dataStreamPath); - // default ingest pipeline name see https://github.com/elastic/package-registry/blob/master/util/dataset.go#L26 dataStreams.push( Object.entries(restOfProps).reduce( (validatedDataStream, [key, value]) => { @@ -233,7 +232,7 @@ export function parseAndVerifyDataStreams( type, package: pkgName, dataset: dataset || `${pkgName}.${dataStreamPath}`, - ingest_pipeline: ingestPipeline || 'default', + ingest_pipeline: ingestPipeline, path: dataStreamPath, streams, } diff --git a/x-pack/test/fleet_api_integration/apis/epm/__snapshots__/install_by_upload.snap b/x-pack/test/fleet_api_integration/apis/epm/__snapshots__/install_by_upload.snap index 13c2dd24f9103..b47b0d21ecf0d 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/__snapshots__/install_by_upload.snap +++ b/x-pack/test/fleet_api_integration/apis/epm/__snapshots__/install_by_upload.snap @@ -167,7 +167,6 @@ Object { "data_streams": Array [ Object { "dataset": "apache.access", - "ingest_pipeline": "default", "package": "apache", "path": "access", "release": "experimental", @@ -199,7 +198,6 @@ Object { }, Object { "dataset": "apache.status", - "ingest_pipeline": "default", "package": "apache", "path": "status", "release": "experimental", @@ -236,7 +234,6 @@ Object { }, Object { "dataset": "apache.error", - "ingest_pipeline": "default", "package": "apache", "path": "error", "release": "experimental", @@ -330,11 +327,11 @@ Object { "install_version": "0.1.4", "installed_es": Array [ Object { - "id": "logs-apache.access-0.1.4", + "id": "logs-apache.access-0.1.4-default", "type": "ingest_pipeline", }, Object { - "id": "logs-apache.error-0.1.4", + "id": "logs-apache.error-0.1.4-default", "type": "ingest_pipeline", }, Object { diff --git a/x-pack/test/fleet_api_integration/apis/epm/install_by_upload.ts b/x-pack/test/fleet_api_integration/apis/epm/install_by_upload.ts index 06130775ec3cb..d045e771d7c50 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/install_by_upload.ts +++ b/x-pack/test/fleet_api_integration/apis/epm/install_by_upload.ts @@ -70,7 +70,7 @@ export default function (providerContext: FtrProviderContext) { .type('application/gzip') .send(buf) .expect(200); - expect(res.body.response.length).to.be(26); + expect(res.body.response.length).to.be(24); }); it('should install a zip archive correctly and package info should return correctly after validation', async function () { @@ -81,7 +81,7 @@ export default function (providerContext: FtrProviderContext) { .type('application/zip') .send(buf) .expect(200); - expect(res.body.response.length).to.be(26); + expect(res.body.response.length).to.be(24); const packageInfoRes = await supertest .get(`/api/fleet/epm/packages/${testPkgKey}`)