[Fleet] fix duplicate ingest pipeline refs #82078
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #76818
An
epm-packges
saved object was saving duplicates of pipelines in theinstalled_es
property when installing the same version, each time it was installed.Pipelines are handled differently than other elasticsearch assets because they cannot be removed until other assets are installed, so during an upgrade they aren't removed until the end and the old versionized pipelines are searched for, eg:
logs-nginx.ingress_controller-0.3.5
. In the case where the user is installing the same version (reinstall), there is no previous version to search for, and the new assets are the same as the old, so we should do a check during the installation of pipelines to make sure this version's pipelines don't already exist in the saved object, and if they do, remove them, before saving the new ones of the same version. This prevents duplication of the same pipelines.Tests are updated to check that installing and reinstalling have the same installed assets and saved objects to cover this case. I separated the tests out into one function that both cases can call.