GetMemberData should call the patroni endpoint

This commit is contained in:
Felix Kunde 2021-10-11 10:13:30 +02:00
parent 957c2582f6
commit c49974c166
1 changed files with 5 additions and 1 deletions

View File

@ -124,6 +124,10 @@ func (p *Patroni) httpGet(url string) (string, error) {
return "", fmt.Errorf("could not read response: %v", err)
}
if response.StatusCode != http.StatusOK {
return string(bodyBytes), fmt.Errorf("patroni returned '%d'", response.StatusCode)
}
return string(bodyBytes), nil
}
@ -253,7 +257,7 @@ func (p *Patroni) GetMemberData(server *v1.Pod) (MemberData, error) {
if err != nil {
return MemberData{}, err
}
body, err := p.httpGet(apiURLString)
body, err := p.httpGet(apiURLString + statusPath)
if err != nil {
return MemberData{}, err
}