[ARVADOS] updated: 1.3.0-1956-gc09adb3ad
Git user
git at public.curoverse.com
Fri Nov 29 07:46:21 UTC 2019
Summary of changes:
lib/controller/federation/list.go | 11 ++++++++---
lib/controller/federation/list_test.go | 6 +++---
lib/controller/router/router.go | 4 ++++
sdk/go/arvados/client.go | 9 ++++++---
4 files changed, 21 insertions(+), 9 deletions(-)
via c09adb3ad51eca81e21914582a3cbf92816a3700 (commit)
via 5ce55817039488a4445287191025212a14e50de8 (commit)
via e92e0f23b7b9bef63e581c3214a133d7dd3196ed (commit)
via dfcbc87f0e67febb94bc9fc39a3601928534f851 (commit)
from 278e53556cb9623c0450cae6b9e21bab682be58f (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 c09adb3ad51eca81e21914582a3cbf92816a3700
Merge: 278e53556 5ce558170
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Fri Nov 29 02:46:15 2019 -0500
Merge branch '15864-controller-fixes'
refs #15864
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
commit 5ce55817039488a4445287191025212a14e50de8
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Fri Nov 29 02:42:09 2019 -0500
15864: Use POST/X-Http-Method-Override instead of long request URLs.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/sdk/go/arvados/client.go b/sdk/go/arvados/client.go
index 8545cb969..58c0de825 100644
--- a/sdk/go/arvados/client.go
+++ b/sdk/go/arvados/client.go
@@ -281,9 +281,8 @@ func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, m
}
if urlValues == nil {
// Nothing to send
- } else if method == "GET" || method == "HEAD" || body != nil {
- // Must send params in query part of URL (FIXME: what
- // if resulting URL is too long?)
+ } else if body != nil || ((method == "GET" || method == "HEAD") && len(urlValues.Encode()) < 1000) {
+ // Send params in query part of URL
u, err := url.Parse(urlString)
if err != nil {
return err
@@ -297,6 +296,10 @@ func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, m
if err != nil {
return err
}
+ if (method == "GET" || method == "HEAD") && body != nil {
+ req.Header.Set("X-Http-Method-Override", method)
+ req.Method = "POST"
+ }
req = req.WithContext(ctx)
req.Header.Set("Content-type", "application/x-www-form-urlencoded")
for k, v := range c.SendHeader {
commit e92e0f23b7b9bef63e581c3214a133d7dd3196ed
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Fri Nov 29 02:38:35 2019 -0500
15864: Support X-Http-Method-Override header used by Python SDK.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/lib/controller/router/router.go b/lib/controller/router/router.go
index 47082197a..cde6a8e32 100644
--- a/lib/controller/router/router.go
+++ b/lib/controller/router/router.go
@@ -387,6 +387,10 @@ func (rtr *router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
r2 := *r
r = &r2
r.Method = m
+ } else if m = r.Header.Get("X-Http-Method-Override"); m != "" {
+ r2 := *r
+ r = &r2
+ r.Method = m
}
rtr.mux.ServeHTTP(w, r)
}
commit dfcbc87f0e67febb94bc9fc39a3601928534f851
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Fri Nov 29 02:37:41 2019 -0500
15864: Fix error response when requesting nonexistent UUIDs.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/lib/controller/federation/list.go b/lib/controller/federation/list.go
index 26b6b254e..8650491dd 100644
--- a/lib/controller/federation/list.go
+++ b/lib/controller/federation/list.go
@@ -237,7 +237,7 @@ func (conn *Conn) splitListRequest(ctx context.Context, opts arvados.ListOptions
done, err := fn(ctx, clusterID, backend, remoteOpts)
if err != nil {
- errs <- err
+ errs <- httpErrorf(http.StatusBadGateway, err.Error())
return
}
progress := false
@@ -247,8 +247,13 @@ func (conn *Conn) splitListRequest(ctx context.Context, opts arvados.ListOptions
delete(todo, uuid)
}
}
- if !progress {
- errs <- httpErrorf(http.StatusBadGateway, "cannot make progress in federated list query: cluster %q returned none of the requested UUIDs", clusterID)
+ if len(done) == 0 {
+ // Zero items == no more
+ // results exist, no need to
+ // get another page.
+ break
+ } else if !progress {
+ errs <- httpErrorf(http.StatusBadGateway, "cannot make progress in federated list query: cluster %q returned %d items but none had the requested UUIDs", clusterID, len(done))
return
}
}
diff --git a/lib/controller/federation/list_test.go b/lib/controller/federation/list_test.go
index a9c4f588f..30749aac3 100644
--- a/lib/controller/federation/list_test.go
+++ b/lib/controller/federation/list_test.go
@@ -338,7 +338,7 @@ func (s *CollectionListSuite) TestCollectionListRemoteUnknown(c *check.C) {
}
func (s *CollectionListSuite) TestCollectionListRemoteError(c *check.C) {
- s.addDirectRemote(c, "bbbbb", &arvadostest.APIStub{})
+ s.addDirectRemote(c, "bbbbb", &arvadostest.APIStub{Error: fmt.Errorf("stub backend error")})
s.test(c, listTrial{
count: "none",
limit: -1,
@@ -359,8 +359,8 @@ func (s *CollectionListSuite) test(c *check.C, trial listTrial) {
})
if trial.expectStatus != 0 {
c.Assert(err, check.NotNil)
- err, _ := err.(interface{ HTTPStatus() int })
- c.Assert(err, check.NotNil) // err must implement HTTPStatus()
+ err, ok := err.(interface{ HTTPStatus() int })
+ c.Assert(ok, check.Equals, true) // err must implement interface{ HTTPStatus() int }
c.Check(err.HTTPStatus(), check.Equals, trial.expectStatus)
c.Logf("returned error is %#v", err)
c.Logf("returned error string is %q", err)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list