Merge pull request #818 from nicksardo/gce-fix-backendStatus
[GLBC] Fix backend status out of bounds error
This commit is contained in:
commit
82bc0059aa
1 changed files with 3 additions and 1 deletions
|
@ -419,9 +419,11 @@ func (b *Backends) Shutdown() error {
|
||||||
// Status returns the status of the given backend by name.
|
// Status returns the status of the given backend by name.
|
||||||
func (b *Backends) Status(name string) string {
|
func (b *Backends) Status(name string) string {
|
||||||
backend, err := b.cloud.GetBackendService(name)
|
backend, err := b.cloud.GetBackendService(name)
|
||||||
if err != nil {
|
if err != nil || len(backend.Backends) == 0 {
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Look at more than one backend's status
|
||||||
// TODO: Include port, ip in the status, since it's in the health info.
|
// TODO: Include port, ip in the status, since it's in the health info.
|
||||||
hs, err := b.cloud.GetHealth(name, backend.Backends[0].Group)
|
hs, err := b.cloud.GetHealth(name, backend.Backends[0].Group)
|
||||||
if err != nil || len(hs.HealthStatus) == 0 || hs.HealthStatus[0] == nil {
|
if err != nil || len(hs.HealthStatus) == 0 || hs.HealthStatus[0] == nil {
|
||||||
|
|
Loading…
Reference in a new issue