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

[8.6] Catching saved object not found error, do not delete referenced package assets (#146274) #146411

Merged
merged 3 commits into from
Nov 30, 2022

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.6:

Questions ?

Please refer to the Backport tool documentation

…ge assets (elastic#146274)

## Summary

Fixes elastic#142112

Improvements coming out of SDHs, to handle Fleet errors more robustly.

### 1. Catching package assets not found error and logging a warning, to
prevent it blocking setup/install.
### 2. In assets cleanup logic, doing a check that the assets are not
referenced by packages before deleting them.

Verifying 1. and 2. hard, because I don't have a way to reproduce the
assets not found error. Tried to install/delete different versions of a
package, but didn't run into the issues.

### 3. Force removing a package deletes package policies as well

To verify:
- add at least one integration (e.g. system package)
- force delete integration with API
```
DELETE http://elastic:changeme@localhost:5601/julia/api/fleet/epm/packages/system/1.20.4
kbn-xsrf: kibana

{ "force": true }
```
- verify that package policies are deleted as well
- there is an info log added:
```
[2022-11-24T14:10:29.138+01:00][INFO ][plugins.fleet] deleting package policies of system package because force flag was enabled: 84a4e5d4-e363-4045-9240-9ab151f2b376,6d34a544-7467-48fd-a779-c2d30d808aa6
```

### 4. Catching saved object not found error when tagging package assets
To verify:
- follow the steps above to force delete a package
- add system integration again
- verify that it succeeds, and there is a warning log
```
[2022-11-24T14:07:47.960+01:00][WARN ][plugins.fleet] Error: Saved object [dashboard/system-01c54730-fee6-11e9-8405-516218e3d268] not found
```

### 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>
(cherry picked from commit 7198faf)
@kibanamachine kibanamachine enabled auto-merge (squash) November 28, 2022 15:11
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Nov 28, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic
Copy link
Contributor

@elasticmachine merge upstream

@juliaElastic
Copy link
Contributor

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 441 447 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 68 74 +6
osquery 109 115 +6
securitySolution 518 524 +6
total +20

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @juliaElastic

@kibanamachine kibanamachine merged commit 89882cc into elastic:8.6 Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants