-
Notifications
You must be signed in to change notification settings - Fork 119
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
Skip error uninstalling system package #1315
Changes from 7 commits
57a2053
454576a
d7fb416
2caae88
78b628a
ded8026
3d8d121
29a492e
6e0af5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -496,10 +496,25 @@ func (r *runner) runTest(config *testConfig, ctxt servicedeployer.ServiceContext | |
} | ||
r.deletePackageHandler = func() error { | ||
err := installer.Uninstall() | ||
if err != nil { | ||
return fmt.Errorf("failed to uninstall package: %v", err) | ||
if err == nil { | ||
return nil | ||
} | ||
// 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 | ||
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()) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also show a Debug message in case 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, let's log the error only for other packages. |
||
|
||
return nil | ||
// 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 | ||
} | ||
|
||
// Configure package (single data stream) via Ingest Manager APIs. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
links: | ||
elastic-main: "https://www.elastic.co/guide" | ||
getting-started-observability: "https://www.elastic.co/guide/en/welcome-to-elastic/current/getting-started-observability.html" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dependencies: | ||
ecs: | ||
reference: [email protected] |
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.
It may be also good to add a comment here about why we are only logging the error and not returning it.
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.
Added comment to explain it 6e0af5e