Skip to content

Commit

Permalink
fix: agent enroll failed (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
luohoufu authored Dec 7, 2024
1 parent 9812249 commit 356f710
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/agent/api/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"context"
"errors"
"fmt"
"github.com/buger/jsonparser"
log "github.com/cihub/seelog"
"infini.sh/console/plugin/managed/server"
httprouter "infini.sh/framework/core/api/router"
Expand Down Expand Up @@ -661,6 +662,9 @@ func (h *APIHandler) getESNodeInfoViaProxy(esHost string, esSchema string, auth

func (h *APIHandler) getESNodeInfoViaProxyWithConfig(cfg *elastic.ElasticsearchConfig, auth *model.BasicAuth, endpoint string) (success, tryAgain bool, info *elastic.LocalNodeInfo) {
body := util.MustToJSONBytes(cfg)
if cfg.BasicAuth != nil {
body, _ = jsonparser.Set(body, []byte(`"`+cfg.BasicAuth.Password.Get()+`"`), "basic_auth", "password")
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
req := &util.Request{
Expand Down

0 comments on commit 356f710

Please sign in to comment.