From 4d26d4abd4a9f9cdb64992af4150bc14ea7fdfa6 Mon Sep 17 00:00:00 2001 From: nnamdifrankie Date: Thu, 15 Oct 2020 23:01:03 -0400 Subject: [PATCH] 80697: add warning statement --- .../server/services/epm/elasticsearch/transform/common.ts | 6 ++++++ .../server/services/epm/elasticsearch/transform/remove.ts | 3 +++ .../services/epm/elasticsearch/transform/transform.test.ts | 1 + 3 files changed, 10 insertions(+) diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/common.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/common.ts index 46f36dba96747..0f8b723388e11 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/common.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/common.ts @@ -4,8 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ +import { Logger } from 'src/core/server'; import * as Registry from '../../registry'; +import { appContextService } from '../../../app_context'; export const getAsset = (path: string): Buffer => { return Registry.getAsset(path); }; + +export const getLogger = (): Logger => { + return appContextService.getLogger(); +}; diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/remove.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/remove.ts index 7bbb573ad114a..bbdd8c06091b2 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/remove.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/remove.ts @@ -7,6 +7,7 @@ import { SavedObjectsClientContract } from 'kibana/server'; import { CallESAsCurrentUser, ElasticsearchAssetType, EsAssetReference } from '../../../../types'; import { PACKAGES_SAVED_OBJECT_TYPE } from '../../../../../common/constants'; +import { getLogger } from './common'; export const stopTransforms = async (transformIds: string[], callCluster: CallESAsCurrentUser) => { for (const transformId of transformIds) { @@ -56,6 +57,8 @@ export const deleteTransforms = async ( ignore: [404], }); } + } else { + getLogger().warn(`cannot find transform for ${transformId}`); } }) ); diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/transform.test.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/transform.test.ts index 2bf0ad12856f8..00067d477cf94 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/transform.test.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/transform/transform.test.ts @@ -11,6 +11,7 @@ jest.mock('../../packages/get', () => { jest.mock('./common', () => { return { getAsset: jest.fn(), + getLogger: jest.fn(), }; });