[ARVADOS] updated: 2.1.0-302-g0945afa55
Git user
git at public.arvados.org
Wed Jan 27 06:56:28 UTC 2021
Summary of changes:
cmd/arvados-client/container_gateway.go | 4 ++++
sdk/go/arvados/client.go | 13 +++++++++++++
2 files changed, 17 insertions(+)
via 0945afa5523fb45f827750e4d1700df4ff222295 (commit)
via 28e5a3c88c43be042332ec5d03b65a00509da978 (commit)
from dba001d209d9658cdf0adec182376137c5d65244 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 0945afa5523fb45f827750e4d1700df4ff222295
Author: Tom Clegg <tom at curii.com>
Date: Wed Jan 27 01:55:32 2021 -0500
17170: Return more helpful error if APIHost is not set.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/sdk/go/arvados/client.go b/sdk/go/arvados/client.go
index 52c75d511..ea3cb6899 100644
--- a/sdk/go/arvados/client.go
+++ b/sdk/go/arvados/client.go
@@ -9,6 +9,7 @@ import (
"context"
"crypto/tls"
"encoding/json"
+ "errors"
"fmt"
"io"
"io/ioutil"
@@ -67,6 +68,10 @@ type Client struct {
dd *DiscoveryDocument
defaultRequestID string
+
+ // APIHost and AuthToken were loaded from ARVADOS_* env vars
+ // (used to customize "no host/token" error messages)
+ loadedFromEnv bool
}
// InsecureHTTPClient is the default http.Client used by a Client with
@@ -123,6 +128,7 @@ func NewClientFromEnv() *Client {
Insecure: insecure,
KeepServiceURIs: svcs,
Timeout: 5 * time.Minute,
+ loadedFromEnv: true,
}
}
@@ -312,6 +318,13 @@ func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, m
// Ensure body is closed even if we error out early
defer body.Close()
}
+ if c.APIHost == "" {
+ if c.loadedFromEnv {
+ return errors.New("ARVADOS_API_HOST and/or ARVADOS_API_TOKEN environment variables are not set")
+ } else {
+ return errors.New("arvados.Client cannot perform request: APIHost is not set")
+ }
+ }
urlString := c.apiURL(path)
urlValues, err := anythingToValues(params)
if err != nil {
commit 28e5a3c88c43be042332ec5d03b65a00509da978
Author: Tom Clegg <tom at curii.com>
Date: Wed Jan 27 01:45:20 2021 -0500
17170: More helpful message if ARVADOS_* env vars are not set.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/cmd/arvados-client/container_gateway.go b/cmd/arvados-client/container_gateway.go
index 2d6fd5eec..6dbc241bc 100644
--- a/cmd/arvados-client/container_gateway.go
+++ b/cmd/arvados-client/container_gateway.go
@@ -128,6 +128,10 @@ Options:
loginUsername = targetUUID[:i]
targetUUID = targetUUID[i+1:]
}
+ if os.Getenv("ARVADOS_API_HOST") == "" || os.Getenv("ARVADOS_API_TOKEN") == "" {
+ fmt.Fprintln(stderr, "fatal: ARVADOS_API_HOST and ARVADOS_API_TOKEN environment variables are not set")
+ return 1
+ }
insecure := os.Getenv("ARVADOS_API_HOST_INSECURE")
rpcconn := rpc.NewConn("",
&url.URL{
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list