[ARVADOS] updated: 1.2.0-109-gce572d4c9

Git user git at public.curoverse.com
Thu Sep 27 17:00:40 EDT 2018


Summary of changes:
 lib/controller/federation.go | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

       via  ce572d4c9234b6e08940f2ce265578a1e99b83f4 (commit)
      from  0b0ca98b0777b7a2043d28536c7addda4eacd71d (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 ce572d4c9234b6e08940f2ce265578a1e99b83f4
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Thu Sep 27 17:00:29 2018 -0400

    13619: Polish error handling
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/controller/federation.go b/lib/controller/federation.go
index 72a147ae7..51c2dbd96 100644
--- a/lib/controller/federation.go
+++ b/lib/controller/federation.go
@@ -164,10 +164,12 @@ func (h *genericFederatedRequestHandler) handleMultiClusterQuery(w http.Response
 
 	// Split the list of uuids by prefix
 	queryClusters := make(map[string][]string)
-	if len(filters) == 1 && len(filters[0]) == 3 {
-		f1 := filters[0]
-		lhs := f1[0].(string)
-		if lhs == "uuid" {
+	for _, f1 := range filters {
+		if len(f1) != 3 {
+			return false
+		}
+		lhs, ok := f1[0].(string)
+		if ok && lhs == "uuid" {
 			op, ok := f1[1].(string)
 			if !ok {
 				return false
@@ -188,19 +190,27 @@ func (h *genericFederatedRequestHandler) handleMultiClusterQuery(w http.Response
 					*clusterId = u[0:5]
 					queryClusters[u[0:5]] = append(queryClusters[u[0:5]], u)
 				}
+			} else {
+				return false
 			}
+		} else {
+			return false
 		}
-
 	}
 
 	if len(queryClusters) <= 1 {
-		// Didn't find ["uuid", "in", ...] filters for multiple clusters
+		// Did not find a list query to search for uuids
+		// across multiple clusters.
 		return false
 	}
 
 	if !(len(params["count"]) == 1 && (params["count"][0] == `none` ||
 		params["count"][0] == `"none"`)) {
-		httpserver.Error(w, "Federated multi-object query must have count=none", http.StatusBadRequest)
+		httpserver.Error(w, "Federated multi-object query must have 'count=none'", http.StatusBadRequest)
+		return true
+	}
+	if len(params["limit"]) != 0 || len(params["offset"]) != 0 || len(params["order"]) != 0 {
+		httpserver.Error(w, "Federated multi-object may not provide 'limit', 'offset' or 'order'.", http.StatusBadRequest)
 		return true
 	}
 
@@ -230,6 +240,9 @@ func (h *genericFederatedRequestHandler) handleMultiClusterQuery(w http.Response
 			remoteParams := make(url.Values)
 			remoteParams["_method"] = []string{"GET"}
 			remoteParams["count"] = []string{"none"}
+			if _, ok := params["select"]; ok {
+				remoteParams["select"] = params["select"]
+			}
 			content, err := json.Marshal(v)
 			if err != nil {
 				rc.mtx.Lock()

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list