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

[Ingest Manager] Clean action store after enrolling to new configuration #18656

Merged
merged 2 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Fix jq: command not found {pull}18408[18408]
- Avoid Chown on windows {pull}18512[18512]
- Remove fleet admin from setup script {pull}18611[18611]
- Clean action store after enrolling to new configuration {pull}18656[18656]

==== New features

Expand Down
7 changes: 7 additions & 0 deletions x-pack/elastic-agent/pkg/agent/application/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io"
"net/http"
"net/url"
"os"

"gopkg.in/yaml.v2"

Expand Down Expand Up @@ -179,6 +180,12 @@ func (c *EnrollCmd) Execute() error {
return err
}

// clear action store
// fail only if file exists and there was a failure
if err := os.Remove(info.AgentActionStoreFile()); !os.IsNotExist(err) {
return err
}

return nil
}

Expand Down