Skip to content

Commit fa5686c

Browse files
authored
fix: Add instance delete fallback (#283)
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.com> Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.com>
2 parents fadc971 + 667279e commit fa5686c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

internal/cmd/instances.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,13 @@ func (Instance) Delete(ctx context.Context, targets []resource.Resource) error {
607607
}
608608
}
609609
instances, err := c.DeleteInstances(ctx, reqs)
610+
if err != nil && strings.Contains(err.Error(), "timeout_s") && strings.Contains(err.Error(), "is not a valid member") {
611+
// HACK: retry without timeout_s for metros that don't support it.
612+
for i := range reqs {
613+
reqs[i].TimeoutS = nil
614+
}
615+
instances, err = c.DeleteInstances(ctx, reqs)
616+
}
610617
if err != nil && !platform.ErrorContainsOnly(err, platform.APIHTTPErrorNotFound) {
611618
return nil, err
612619
}

0 commit comments

Comments
 (0)