Skip error uninstalling system package#1315
Merged
mrodm merged 9 commits intoelastic:mainfrom Jun 21, 2023
Merged
Conversation
Contributor
Author
|
test integrations |
Collaborator
|
Created or updated PR in integrations repostiory to test this vesrion. Check elastic/integrations#6619 |
Contributor
Author
|
mrodm
commented
Jun 20, 2023
Comment on lines
+504
to
+509
| switch pkgManifest.Name { | ||
| case "system": | ||
| logger.Debugf("failed to uninstall package %q: %s", pkgManifest.Name, err.Error()) | ||
| default: | ||
| logger.Warnf("failed to uninstall package %q: %s", pkgManifest.Name, err.Error()) | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Should we also show a Debug message in case system package fails ? It will always fail. Same for asset runner.
If not this code could be just changed to be something like:
// by default system package is part of an agent policy and it cannot be uninstalled
// https://github.com/elastic/elastic-package/blob/5f65dc29811c57454bc7142aaf73725b6d4dc8e6/internal/stack/_static/kibana.yml.tmpl#L62
if err != nil && pkgManifest.Name != "system" {
logger.Warnf("failed to uninstall package %q: %s", pkgManifest.Name, err.Error())
}
return nil
Member
There was a problem hiding this comment.
Yeah, let's log the error only for other packages.
jsoriano
approved these changes
Jun 20, 2023
| // by default system package is part of an agent policy and it cannot be uninstalled | ||
| // https://github.com/elastic/elastic-package/blob/5f65dc29811c57454bc7142aaf73725b6d4dc8e6/internal/stack/_static/kibana.yml.tmpl#L62 | ||
| if err != nil && pkgManifest.Name != "system" { | ||
| logger.Warnf("failed to uninstall package %q: %s", pkgManifest.Name, err.Error()) |
Member
There was a problem hiding this comment.
It may be also good to add a comment here about why we are only logging the error and not returning it.
Collaborator
💚 Build Succeeded
History
cc @mrodm |
jsoriano
approved these changes
Jun 20, 2023
4 tasks
4 tasks
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR has two goals:
systempackage is uninstalledCurrently,
systempackage is being used by default as part of another agent policy. Because of that, when system or asset tests finish and try to uninstall the package, if this package issystem, this fails with this error:As part of this PR,
assettests has also been checked and fixed since this test runner also performs the uninstallation of the package.