Skip to content

Commit

Permalink
Ignore not found component templates when dumping installed objects (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored Apr 17, 2024
1 parent 0dda40a commit 78dcc52
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/dump/componenttemplates.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io"
"net/http"

"github.com/elastic/elastic-package/internal/elasticsearch"
)
Expand Down Expand Up @@ -71,6 +72,10 @@ func getComponentTemplatesByName(ctx context.Context, api *elasticsearch.API, na
}
defer resp.Body.Close()

// Component templates referenced by other templates may not exist.
if resp.StatusCode == http.StatusNotFound {
return nil, nil
}
if resp.IsError() {
return nil, fmt.Errorf("failed to get component template %s: %s", name, resp.String())
}
Expand Down

0 comments on commit 78dcc52

Please sign in to comment.