Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
rkthtrifork committed Jun 11, 2024
1 parent 38848b8 commit ffd3c3e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"strings"

"github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests"
"github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/opensearch-project/opensearch-go/opensearchutil"
Expand Down Expand Up @@ -70,13 +73,16 @@ func GetPolicy(ctx context.Context, service *OsClusterClient, policyName string)
// CreateISMPolicy creates the passed policy
func CreateISMPolicy(ctx context.Context, service *OsClusterClient, ismpolicy requests.Policy, policyId string) error {
spec := opensearchutil.NewJSONReader(ismpolicy)
lg := log.FromContext(ctx).WithValues("os_service", "policy")
buf := new(strings.Builder)
io.Copy(buf, spec)
lg.Info("rkth request: " + spew.Sdump(buf.String()))
resp, err := service.PutISMConfig(ctx, policyId, spec)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.IsError() {
lg := log.FromContext(ctx).WithValues("os_service", "policy")
lg.Info("rkth os_ism_service.go 1")
return fmt.Errorf("failed to create ism policy: %s", resp.String())
}
Expand Down

0 comments on commit ffd3c3e

Please sign in to comment.