Skip to content

Commit

Permalink
[Ingest Manager] Clean action store after enrolling to new configurat…
Browse files Browse the repository at this point in the history
…ion (#18656) (#18713)

* clear actions after new enroll
  • Loading branch information
michalpristas authored May 26, 2020
1 parent b4ee7d9 commit 3c33fde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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 @@
- Stop monitoring on config change {pull}18284[18284]
- Fix jq: command not found {pull}18408[18408]
- Avoid Chown on windows {pull}18512[18512]
- 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

0 comments on commit 3c33fde

Please sign in to comment.