diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-04-17 10:27:31 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2023-04-17 10:31:43 +0200 |
commit | 7040b8c2c454a79316f800a5c4a9977e96905b81 (patch) | |
tree | 882f4f53e42a873e1437669c6df67a63be25d616 /client/go/internal/vespa/target_cloud.go | |
parent | 468dc5f1a47f3d7d90ae7e83476344c55c20b149 (diff) |
Never wait on 4xx for any target
Diffstat (limited to 'client/go/internal/vespa/target_cloud.go')
-rw-r--r-- | client/go/internal/vespa/target_cloud.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/client/go/internal/vespa/target_cloud.go b/client/go/internal/vespa/target_cloud.go index e9dca55f654..928bb788494 100644 --- a/client/go/internal/vespa/target_cloud.go +++ b/client/go/internal/vespa/target_cloud.go @@ -123,7 +123,7 @@ func (t *cloudTarget) Service(name string, timeout time.Duration, runID int64, c if err != nil { return nil, err } - if !isOK(status) { + if ok, _ := isOK(status); !ok { return nil, fmt.Errorf("got status %d from deploy service at %s", status, service.BaseURL) } } @@ -209,7 +209,7 @@ func (t *cloudTarget) PrintLog(options LogOptions) error { return req } logFunc := func(status int, response []byte) (bool, error) { - if ok, err := isCloudOK(status); !ok { + if ok, err := isOK(status); !ok { return ok, err } logEntries, err := ReadLogEntries(bytes.NewReader(response)) @@ -272,7 +272,7 @@ func (t *cloudTarget) waitForRun(runID int64, timeout time.Duration) error { return req } jobSuccessFunc := func(status int, response []byte) (bool, error) { - if ok, err := isCloudOK(status); !ok { + if ok, err := isOK(status); !ok { return ok, err } var resp jobResponse @@ -327,7 +327,7 @@ func (t *cloudTarget) discoverEndpoints(timeout time.Duration) error { } urlsByCluster := make(map[string]string) endpointFunc := func(status int, response []byte) (bool, error) { - if ok, err := isCloudOK(status); !ok { + if ok, err := isOK(status); !ok { return ok, err } var resp deploymentResponse @@ -354,11 +354,3 @@ func (t *cloudTarget) discoverEndpoints(timeout time.Duration) error { t.deploymentOptions.ClusterURLs = urlsByCluster return nil } - -func isCloudOK(status int) (bool, error) { - if status == 401 { - // when retrying we should give up immediately if we're not authorized - return false, fmt.Errorf("status %d: invalid credentials", status) - } - return isOK(status), nil -} |