Skip to content

Commit efb664a

Browse files
authored
Extend Load Balancer creation waiter to look for errors in Errors field (#354)
* Extend Load Balancer creation waiter to look for errors in `Errors` field * Fix date in changelog * Re-add comment removed by mistake * Add status to error message; Improve changelog
1 parent 82dc248 commit efb664a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

services/loadbalancer/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v0.9.3 (2024-03-19)
2+
3+
- Improve error handling in Load Balancer creation waiter, fixing timeout being exceeded for `STATUS_PENDING` status with errors. If an error is found in the `Errors` field, the waiter now returns with error.
4+
15
## v0.9.2 (2024-02-28)
26

37
- Update `core` to [`v0.10.0`](../../core/CHANGELOG.md#v0100-2024-02-27)

services/loadbalancer/wait/wait.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"net/http"
7+
"strings"
78
"time"
89

910
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
@@ -46,6 +47,15 @@ func CreateLoadBalancerWaitHandler(ctx context.Context, a APIClientInterface, pr
4647
if s == nil || s.Name == nil || *s.Name != instanceName || s.Status == nil {
4748
return false, nil, nil
4849
}
50+
51+
var errors []string
52+
if s.Errors != nil && len(*s.Errors) > 0 {
53+
for _, err := range *s.Errors {
54+
errors = append(errors, fmt.Sprintf("%s: %s", *err.Type, *err.Description))
55+
}
56+
return true, s, fmt.Errorf("create failed for instance with name %s, got status %s and errors: %s", instanceName, *s.Status, strings.Join(errors, ";"))
57+
}
58+
4959
switch *s.Status {
5060
case InstanceStatusReady:
5161
return true, s, nil

0 commit comments

Comments
 (0)