[8.17] [Fleet] EPM - Fix error message for data stream settings update (#210330) (#210540)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[Fleet] EPM - Fix error message for data stream settings update
(#210330)](https://github.com/elastic/kibana/pull/210330)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jill
Guyonnet","email":"jill.guyonnet@elastic.co"},"sourceCommit":{"committedDate":"2025-02-11T11:25:13Z","message":"[Fleet]
EPM - Fix error message for data stream settings update (#210330)\n\n##
Summary\r\n\r\nDuring package installation, failure to update the
default pipeline for\r\ndata streams currently has a misleading error
message. This PR corrects\r\nthis and adds the original error message to
improve clarity.\r\n\r\n### Identify
risks\r\n\r\nN/A\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"2f4fb3ff2f28384ed2e2ffabee74b678651f5bb9","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","backport:prev-major","v9.1.0"],"title":"[Fleet]
EPM - Fix error message for data stream settings
update","number":210330,"url":"https://github.com/elastic/kibana/pull/210330","mergeCommit":{"message":"[Fleet]
EPM - Fix error message for data stream settings update (#210330)\n\n##
Summary\r\n\r\nDuring package installation, failure to update the
default pipeline for\r\ndata streams currently has a misleading error
message. This PR corrects\r\nthis and adds the original error message to
improve clarity.\r\n\r\n### Identify
risks\r\n\r\nN/A\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"2f4fb3ff2f28384ed2e2ffabee74b678651f5bb9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210330","number":210330,"mergeCommit":{"message":"[Fleet]
EPM - Fix error message for data stream settings update (#210330)\n\n##
Summary\r\n\r\nDuring package installation, failure to update the
default pipeline for\r\ndata streams currently has a misleading error
message. This PR corrects\r\nthis and adds the original error message to
improve clarity.\r\n\r\n### Identify
risks\r\n\r\nN/A\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"2f4fb3ff2f28384ed2e2ffabee74b678651f5bb9"}}]}]
BACKPORT-->

Co-authored-by: Jill Guyonnet <jill.guyonnet@elastic.co>
This commit is contained in:
Kibana Machine 2025-02-12 00:23:02 +11:00 committed by GitHub
parent 465bb1a018
commit bb332236e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1189,7 +1189,7 @@ const updateExistingDataStream = async ({
}
try {
logger.debug(`Updating settings for ${dataStreamName}`);
logger.debug(`Updating index settings of data stream ${dataStreamName}`);
await retryTransientEsErrors(
() =>
@ -1200,8 +1200,11 @@ const updateExistingDataStream = async ({
{ logger }
);
} catch (err) {
logger.error(`Error updating index settings of data stream ${dataStreamName}: ${err}`);
// Same as above - Check if this error can happen because of invalid settings;
// We are returning a 500 but in that case it should be a 400 instead
throw new PackageESError(`Could not update index template settings for ${dataStreamName}`);
throw new PackageESError(
`Could not update index settings of data stream ${dataStreamName}: ${err.message}`
);
}
};