-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Elastic Agent] Support the install, control, and uninstall of Endpoint #19248
Merged
blakerouse
merged 42 commits into
elastic:master
from
blakerouse:agent-endpoint-install
Jun 29, 2020
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
a64aeba
Initial spec parsing for endpoint.
blakerouse a79064b
Update comment.
blakerouse f6a19fe
Fix spec test.
blakerouse 0f93b15
Update code so it copies the entire input.
blakerouse ce54a3f
Fix ast test.
blakerouse f5da411
Merge agent-improve-restart-loop
blakerouse 977f586
Merge agent-endpoint-spec
blakerouse eb630d7
Refactor core/plugin/app into mostly core/ and use core/plugin for di…
blakerouse 7de8c67
Work on endpoint service application.
blakerouse 12ce078
More fixes.
blakerouse 51408bf
Fix format and tests.
blakerouse 4ee0754
Fix some imports.
blakerouse 157d0bd
Merge branch 'master' into agent-endpoint-app
blakerouse bb110fa
More cleanups.
blakerouse fd98ec4
Fix export comment.
blakerouse 26cd0bf
Pass the program.Spec into the descriptor.
blakerouse e4a5aca
Run endpoint verify, install, and uninstall when endpoint should be r…
blakerouse f29dead
Fix install and uninstall of Endpoint
blakerouse a497625
Fix some small issues with service app.
blakerouse e51d529
Merge branch 'agent-endpoint-app' into agent-endpoint-install
blakerouse 73b4fa7
Add changelog entry.
blakerouse 0a3ce3d
Fix lint and tests.
blakerouse 515e664
Merge branch 'agent-endpoint-app' into agent-endpoint-install
blakerouse 1d1c674
Fix lint.
blakerouse c46d208
Merge branch 'master' into agent-endpoint-spec
blakerouse eec7d8d
Remove the code no longer needed because of newer config format.
blakerouse a51226e
Merge branch 'agent-endpoint-spec' into agent-endpoint-app
blakerouse c73d6b1
Fix rules and review.
blakerouse 2d60852
Merge branch 'agent-endpoint-app' into agent-endpoint-install
blakerouse 13dbbda
Update to Endpoint Security.
blakerouse 1a3054d
Fix issues so endpoint security runs.
blakerouse 6c6df5e
Add comments.
blakerouse 1146b2d
Update docstring.
blakerouse c9d9b4e
Merge branch 'master' into agent-endpoint-install
blakerouse 1f32e78
Some more fixes.
blakerouse d97336c
Delete the extra endpoint testdata files.
blakerouse 6bf6cde
Merge branch 'master' into agent-endpoint-install
blakerouse c22b475
Add timeout to exec_file step.
blakerouse d383c5a
Fix supported map.
blakerouse 0283238
Fix getting support programs by cmd.
blakerouse 81ef3d5
Improve app started checks.
blakerouse 6ccfcb1
Fix buildspec.
blakerouse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
55 changes: 55 additions & 0 deletions
55
x-pack/elastic-agent/pkg/agent/operation/operation_uninstall.go
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package operation | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/artifact/uninstall" | ||
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger" | ||
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/state" | ||
) | ||
|
||
// operationUninstall uninstalls a artifact from predefined location | ||
type operationUninstall struct { | ||
logger *logger.Logger | ||
program Descriptor | ||
uninstaller uninstall.Uninstaller | ||
} | ||
|
||
func newOperationUninstall( | ||
logger *logger.Logger, | ||
program Descriptor, | ||
uninstaller uninstall.Uninstaller) *operationUninstall { | ||
|
||
return &operationUninstall{ | ||
logger: logger, | ||
program: program, | ||
uninstaller: uninstaller, | ||
} | ||
} | ||
|
||
// Name is human readable name identifying an operation | ||
func (o *operationUninstall) Name() string { | ||
return "operation-uninstall" | ||
} | ||
|
||
// Check checks whether uninstall needs to be ran. | ||
// | ||
// Always true. | ||
func (o *operationUninstall) Check(_ context.Context, _ Application) (bool, error) { | ||
return true, nil | ||
} | ||
|
||
// Run runs the operation | ||
func (o *operationUninstall) Run(ctx context.Context, application Application) (err error) { | ||
defer func() { | ||
if err != nil { | ||
application.SetState(state.Failed, err.Error()) | ||
} | ||
}() | ||
|
||
return o.uninstaller.Uninstall(ctx, o.program.BinaryName(), o.program.Version(), o.program.Directory()) | ||
} |
Oops, something went wrong.
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.
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.
note: this is breaking between 7.8 and 7.9 so maybe we should put a note that agent might change ID in between versions when updating from 7.8
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.
should we just handle it? support reading it with either
agent_info
oragent
?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.
Lets document it, breaking changes are ok from 7.8->7.9
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.
Created #19488 that handles it transparently, or we can just document. I prefer to just handle it, but okay with breaking.