mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Ingest]: ignore 404, check if there are transforms in results. (#80721)
[Ingest]: ignore 404, check if there are transforms in results
This commit is contained in:
parent
98c751a0f5
commit
cba7e58482
2 changed files with 16 additions and 8 deletions
|
@ -7,6 +7,7 @@
|
|||
import { SavedObjectsClientContract } from 'kibana/server';
|
||||
import { CallESAsCurrentUser, ElasticsearchAssetType, EsAssetReference } from '../../../../types';
|
||||
import { PACKAGES_SAVED_OBJECT_TYPE } from '../../../../../common/constants';
|
||||
import { appContextService } from '../../../app_context';
|
||||
|
||||
export const stopTransforms = async (transformIds: string[], callCluster: CallESAsCurrentUser) => {
|
||||
for (const transformId of transformIds) {
|
||||
|
@ -28,7 +29,7 @@ export const deleteTransforms = async (
|
|||
// get the index the transform
|
||||
const transformResponse: {
|
||||
count: number;
|
||||
transforms: Array<{
|
||||
transforms?: Array<{
|
||||
dest: {
|
||||
index: string;
|
||||
};
|
||||
|
@ -36,6 +37,7 @@ export const deleteTransforms = async (
|
|||
} = await callCluster('transport.request', {
|
||||
method: 'GET',
|
||||
path: `/_transform/${transformId}`,
|
||||
ignore: [404],
|
||||
});
|
||||
|
||||
await stopTransforms([transformId], callCluster);
|
||||
|
@ -46,13 +48,17 @@ export const deleteTransforms = async (
|
|||
ignore: [404],
|
||||
});
|
||||
|
||||
// expect this to be 1
|
||||
for (const transform of transformResponse.transforms) {
|
||||
await callCluster('transport.request', {
|
||||
method: 'DELETE',
|
||||
path: `/${transform?.dest?.index}`,
|
||||
ignore: [404],
|
||||
});
|
||||
if (transformResponse?.transforms) {
|
||||
// expect this to be 1
|
||||
for (const transform of transformResponse.transforms) {
|
||||
await callCluster('transport.request', {
|
||||
method: 'DELETE',
|
||||
path: `/${transform?.dest?.index}`,
|
||||
ignore: [404],
|
||||
});
|
||||
}
|
||||
} else {
|
||||
appContextService.getLogger().warn(`cannot find transform for ${transformId}`);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
|
|
@ -160,6 +160,7 @@ describe('test transform install', () => {
|
|||
{
|
||||
method: 'GET',
|
||||
path: '/_transform/endpoint.metadata_current-default-0.15.0-dev.0',
|
||||
ignore: [404],
|
||||
},
|
||||
],
|
||||
[
|
||||
|
@ -446,6 +447,7 @@ describe('test transform install', () => {
|
|||
{
|
||||
method: 'GET',
|
||||
path: '/_transform/endpoint.metadata-current-default-0.15.0-dev.0',
|
||||
ignore: [404],
|
||||
},
|
||||
],
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue