Skip to content

Commit

Permalink
[Elastic Agent] Handle case where policy doesn't contain Fleet connec…
Browse files Browse the repository at this point in the history
…tion information (#25707)

* Handle case where policy doesn't contain Fleet connection information.

* Add changelog entry.

(cherry picked from commit e86109e)
  • Loading branch information
blakerouse authored and mergify-bot committed May 14, 2021
1 parent 57ad379 commit c6c9aef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
- Fixed issue when unversioned home is set and invoked watcher failing with ENOENT {issue}25371[25371]
- Fixed Elastic Agent: expecting Dict and received *transpiler.Key for '0' {issue}24453[24453]
- Fix AckBatch to do nothing when no actions passed {pull}25562[25562]
- Add error log entry when listener creation fails {issue}23483[23482]
- Handle case where policy doesn't contain Fleet connection information {pull}25707[25707]

==== New features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ func (h *PolicyChange) handleFleetServerHosts(ctx context.Context, c *config.Con
if len(h.setters) == 0 {
return nil
}
data, err := c.ToMapStr()
if err != nil {
return errors.New(err, "could not convert the configuration from the policy", errors.TypeConfig)
}
if _, ok := data["fleet"]; !ok {
// no fleet information in the configuration (skip checking client)
return nil
}

cfg, err := configuration.NewFromConfig(c)
if err != nil {
Expand Down

0 comments on commit c6c9aef

Please sign in to comment.