Skip to content

Commit

Permalink
Merge branch '7.x' into update-stack-version-20210729050752-7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 4, 2021
2 parents 57095f1 + 89ca7f4 commit 1fd07db
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion x-pack/elastic-agent/pkg/agent/operation/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ func (o *Operator) Close() error {
}

// HandleConfig handles configuration for a pipeline and performs actions to achieve this configuration.
func (o *Operator) HandleConfig(cfg configrequest.Request) error {
func (o *Operator) HandleConfig(cfg configrequest.Request) (err error) {
defer func() {
err = filterContextCancelled(err)
}()

_, stateID, steps, ack, err := o.stateResolver.Resolve(cfg)
if err != nil {
o.statusReporter.Update(state.Failed, err.Error(), nil)
Expand Down Expand Up @@ -352,3 +356,10 @@ func (o *Operator) deleteApp(p Descriptor) {
o.logger.Debugf("operator is removing %s from app collection: %v", p.ID(), o.apps)
delete(o.apps, id)
}

func filterContextCancelled(err error) error {
if errors.Is(err, context.Canceled) {
return nil
}
return err
}

0 comments on commit 1fd07db

Please sign in to comment.