Skip to content

Commit

Permalink
Fix VPX REST status checking logic for VPX 10.5. (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
minsikl authored and renier committed Oct 27, 2016
1 parent c37b833 commit 0ceb788
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions softlayer/resource_softlayer_lb_vpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,15 @@ func resourceSoftLayerLbVpxCreate(d *schema.ResourceData, meta interface{}) erro
return fmt.Errorf("Failed to create VIPs for Netscaler VPX ID: %d", id)
}

// Wait VPX service initializing. GetLoadBalancers() internally calls REST API of VPX and returns an error
// if the REST API is not available.
// Wait while VPX service is initializing. GetLoadBalancers() internally calls REST API of VPX and returns
// an error "Could not connect to host" if the REST API is not available.
IsRESTReady := false

for restWaitCount := 0; restWaitCount < 60; restWaitCount++ {
_, err := NADCService.Id(id).GetLoadBalancers()
if err == nil {
// GetLoadBalancers returns an error "There was a problem processing the reply from the
// application tier. Please contact development." if the VPX version is 10.5.
if err == nil || !strings.Contains(err.Error(), "Could not connect to host") {
IsRESTReady = true
break
}
Expand Down

0 comments on commit 0ceb788

Please sign in to comment.