-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Bulk upgrade api response change #95236
[Fleet] Bulk upgrade api response change #95236
Conversation
Pinging @elastic/fleet (Team:Fleet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, just a few string literals in error messages that are missing i18n.
for (const agentResult of givenAgentsResults) { | ||
if (agentResult.found === false) { | ||
outgoingErrors[agentResult._id] = new AgentReassignmentError( | ||
`Cannot find agent ${agentResult._id}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message needs to be wrapped in i18n.translate
if (policy.is_managed) { | ||
throw new IngestManagerError(`Cannot upgrade agent in managed policy ${policy.id}`); | ||
if (!options.force && agent.policy_id && managedPolicies[agent.policy_id]) { | ||
throw new IngestManagerError(`Cannot upgrade agent in managed policy ${agent.policy_id}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs i18n.translate
givenAgents.map(async (agent) => { | ||
const isAllowed = options.force || isAgentUpgradeable(agent, kibanaVersion); | ||
if (!isAllowed) { | ||
throw new IngestManagerError(`${agent.id} is not upgradeable`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs i18n.translate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and work as expected 👍
For translating the errors message, we did not have any error message translated in the Fleet plugin, should we tackle this as an other issue?
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @jfsiii |
@Zacqary Thanks for the review. I agree with you that those error messages should have translations. However, as @nchaulet notes, there are many places which don't yet do that. Are you OK with doing those changes in another PR? I was going to add them in this PR just to start the process, but I have another PR I'm focusing on right now and I'd really like to merge this one. |
@jfsiii Sure, we can merge this one, but let's try to avoid adding new string literals without translations in the future. |
## Summary `/agents/bulk_upgrade` should return a response with a result for each agent given; including invalid or missing ids. It currently returns an empty object. This PR includes commits from open PR elastic#95024. The additions from this PR are https://github.com/jfsiii/kibana/compare/bulk-reassign-response-should-include-all-given-agents..871ebcb [TS type diff for response](https://github.com/jfsiii/kibana/compare/bulk-reassign-response-should-include-all-given-agents..871ebcb#diff-7006a6c170a608c8c7211fc218c0a6f4bc8ff642c170ea264db4b1b5545fb728) ```diff - // eslint-disable-next-line @typescript-eslint/no-empty-interface - export interface PostBulkAgentUpgradeResponse {} + export type PostBulkAgentUpgradeResponse = Record< + Agent['id'], + { + success: boolean; + error?: string; + } + >; ``` ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary `/agents/bulk_upgrade` should return a response with a result for each agent given; including invalid or missing ids. It currently returns an empty object. This PR includes commits from open PR #95024. The additions from this PR are https://github.com/jfsiii/kibana/compare/bulk-reassign-response-should-include-all-given-agents..871ebcb [TS type diff for response](https://github.com/jfsiii/kibana/compare/bulk-reassign-response-should-include-all-given-agents..871ebcb#diff-7006a6c170a608c8c7211fc218c0a6f4bc8ff642c170ea264db4b1b5545fb728) ```diff - // eslint-disable-next-line @typescript-eslint/no-empty-interface - export interface PostBulkAgentUpgradeResponse {} + export type PostBulkAgentUpgradeResponse = Record< + Agent['id'], + { + success: boolean; + error?: string; + } + >; ``` ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: John Schulz <john.schulz@elastic.co>
Summary
/agents/bulk_upgrade
should return a response with a result for each agent given; including invalid or missing ids. It currently returns an empty object.This PR includes commits from open PR #95024. The additions from this PR are https://github.com/jfsiii/kibana/compare/bulk-reassign-response-should-include-all-given-agents..871ebcb
TS type diff for response
Checklist