Skip to content

Commit

Permalink
fix error if indexcomponent is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
urso committed Mar 4, 2021
1 parent 5bf18b2 commit 46de4f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libbeat/template/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,17 @@ func (l *ESLoader) checkExistsTemplate(name string) (bool, error) {
// Other status codes or IO errors during the request are reported as error.
func (l *ESLoader) checkExistsComponentTemplate(name string) (bool, error) {
status, _, err := l.client.Request("GET", "/_component_template/"+name, "", nil, nil)
if err != nil {
return false, err
}

switch status {
case http.StatusNotFound:
return false, nil
case http.StatusOK:
return true, nil
default:
return false, &StatusError{status: status}
if err == nil {
err = &StatusError{status: status}
}
return false, err
}
}

Expand Down

0 comments on commit 46de4f5

Please sign in to comment.