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] Fail gracefully on agent count retrieval #200590

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Nov 18, 2024

Summary

Resolve #192056

When a user do not have the permissions to read agent or agents policies we cannot retrieve the agent count, because of that we were not able to show the confirm modal when updating/delating outputs/binary source. That PR fix that by failing gracefully when we are not able to retrieve that count.

UI Changes

Screenshot 2024-11-18 at 10 20 54 AM Screenshot 2024-11-18 at 10 25 19 AM Screenshot 2024-11-18 at 10 28 09 AM

@nchaulet nchaulet added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Nov 18, 2024
@nchaulet nchaulet self-assigned this Nov 18, 2024
@nchaulet nchaulet requested a review from a team as a code owner November 18, 2024 15:31
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

…gs/components/download_source_flyout/confirm_update.tsx

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nchaulet nchaulet enabled auto-merge (squash) November 18, 2024 16:25
Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments about the copy

<FormattedMessage
id="xpack.fleet.settings.updateDownloadSourceModal.confirmModalTextWithoutCount"
data-test-subj="editDownloadSourcesConfirmModal.confirmModalText"
defaultMessage="This action will update {downloadSourceName} agent binary source. It will update related policies and agents. This action can not be undone. Are you sure you wish to continue?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that repeating the will update part twice sounds a bit strange here. Could we change to something like this instead?
This action will update {downloadSourceName} agent binary source, its related policies and agents. This action can not be undone. Are you sure you wish to continue?

) : (
<FormattedMessage
id="xpack.fleet.settings.deleteDowloadSource.confirmModalTextWithoutCount"
defaultMessage="This action will delete {downloadSourceName} agent binary source. It will update related policies and agents. This action can not be undone. Are you sure you wish to continue?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest:
This action will delete {downloadSourceName} agent binary source and it will update its related policies and agents. This action can not be undone. Are you sure you wish to continue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this sounds better I will made the change

@nchaulet nchaulet disabled auto-merge November 18, 2024 16:36
@@ -67,7 +67,7 @@ const ConfirmDeleteDescription: React.FunctionComponent<ConfirmDeleteDescription
) : (
<FormattedMessage
id="xpack.fleet.settings.deleteDowloadSource.confirmModalTextWithoutCount"
defaultMessage="This action will delete {downloadSourceName} agent binary source. It will update related policies and agents. This action can not be undone. Are you sure you wish to continue?"
defaultMessage="This action will delete {downloadSourceName} agent binary sourceand it will update its related policies and agents. This action can not be undone. Are you sure you wish to continue?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a missing space :)

@nchaulet nchaulet enabled auto-merge (squash) November 18, 2024 17:23
Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! LGTM

@nchaulet nchaulet merged commit e9881a7 into elastic:main Nov 18, 2024
25 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11899451975

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #33 / discover Discover CSV Export Generate CSV: new search generates a report from a new search with data: default

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 1.7MB 1.7MB +1.8KB

cc @nchaulet

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 18, 2024
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 18, 2024
…0641)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Fail gracefully on agent count retrieval
(#200590)](#200590)

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

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

<!--BACKPORT [{"author":{"name":"Nicolas
Chaulet","email":"nicolas.chaulet@elastic.co"},"sourceCommit":{"committedDate":"2024-11-18T19:15:00Z","message":"[Fleet]
Fail gracefully on agent count retrieval
(#200590)","sha":"e9881a7add765f532ab500b7d74f9c988727d2b0","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor"],"title":"[Fleet]
Fail gracefully on agent count
retrieval","number":200590,"url":"https://github.com/elastic/kibana/pull/200590","mergeCommit":{"message":"[Fleet]
Fail gracefully on agent count retrieval
(#200590)","sha":"e9881a7add765f532ab500b7d74f9c988727d2b0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200590","number":200590,"mergeCommit":{"message":"[Fleet]
Fail gracefully on agent count retrieval
(#200590)","sha":"e9881a7add765f532ab500b7d74f9c988727d2b0"}}]}]
BACKPORT-->

Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.17.0 v9.0.0
Projects
None yet
5 participants