Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Silently swallow 404 errors when deleting ingest pipelines #91778

Merged
merged 4 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { SavedObjectsClientContract } from 'src/core/server';
import { appContextService } from '../../../';
import { CallESAsCurrentUser, ElasticsearchAssetType } from '../../../../types';
import { IngestManagerError } from '../../../../errors';
import { getInstallation } from '../../packages/get';
import { PACKAGES_SAVED_OBJECT_TYPE, EsAssetReference } from '../../../../../common';

Expand Down Expand Up @@ -61,7 +62,11 @@ export async function deletePipeline(callCluster: CallESAsCurrentUser, id: strin
try {
await callCluster('ingest.deletePipeline', { id });
} catch (err) {
throw new Error(`error deleting pipeline ${id}`);
// Only throw if error is not a 404 error. Sometimes the pipeline is already deleted, but we have
// duplicate references to them, see https://github.com/elastic/kibana/issues/91192
if (err.statusCode !== 404) {
throw new IngestManagerError(`error deleting pipeline ${id}: ${err}`);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ export const installTransform = async (
previousInstalledTransformEsAssets = installation.installed_es.filter(
({ type, id }) => type === ElasticsearchAssetType.transform
);
logger.info(
`Found previous transform references:\n ${JSON.stringify(previousInstalledTransformEsAssets)}`
);
if (previousInstalledTransformEsAssets.length) {
logger.info(
`Found previous transform references:\n ${JSON.stringify(
previousInstalledTransformEsAssets
)}`
);
}
}

// delete all previous transform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export const deleteTransforms = async (
transformIds: string[]
) => {
const logger = appContextService.getLogger();
logger.info(`Deleting currently installed transform ids ${transformIds}`);
if (transformIds.length) {
logger.info(`Deleting currently installed transform ids ${transformIds}`);
}
await Promise.all(
transformIds.map(async (transformId) => {
// get the index the transform
Expand Down