X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=internal%2Fsdlgoredis%2Fsdlgosentinel.go;h=ac56322bdaa6ad76089b4bfbf14d7840c0c38e5f;hb=refs%2Ftags%2Fv0.9.4;hp=f4395700d1e6e5799ba0ad17afcb7b6965e2cd40;hpb=ee834c59a83cdd10889b3439a281fe43b9f98839;p=ric-plt%2Fsdlgo.git diff --git a/internal/sdlgoredis/sdlgosentinel.go b/internal/sdlgoredis/sdlgosentinel.go index f439570..ac56322 100644 --- a/internal/sdlgoredis/sdlgosentinel.go +++ b/internal/sdlgoredis/sdlgosentinel.go @@ -23,7 +23,9 @@ package sdlgoredis import ( + "fmt" "github.com/go-redis/redis/v7" + "strconv" ) type Sentinel struct { @@ -61,6 +63,14 @@ func (s *Sentinel) GetDbState() (*DbState, error) { state.PrimaryDbState = *pState state.ReplicasDbState = rState state.SentinelsDbState = sState + + cnt, err := strconv.Atoi(s.Cfg.nodeCnt) + if err != nil { + state.Err = fmt.Errorf("Sentinel DBAAS_NODE_COUNT configuration value '%s' conversion to integer failed", s.Cfg.nodeCnt) + return state, state.Err + } + state.ConfigNodeCnt = cnt + if pErr != nil { return state, pErr } @@ -124,7 +134,11 @@ func (s *Sentinel) getSentinelsState() (*SentinelsDbState, error) { if redisErr == nil { for _, redisSentinel := range redisVal { sentinelState := readSentinelState(redisSentinel.([]interface{})) - states.States = append(states.States, sentinelState) + // Ignore a sentinel entry with zero port, because missing of fix + // for the Redis Bug #9240. + if sentinelState.Fields.Port != "0" { + states.States = append(states.States, sentinelState) + } } } states.Err = redisErr