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) (#18712)

* clear actions after new enroll
  • Loading branch information
michalpristas authored May 26, 2020
1 parent 873500a commit 1789aeb
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 @@ -37,6 +37,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

0 comments on commit 1789aeb

Please sign in to comment.