[ARVADOS] created: 1.3.0-1969-g5abaf7eeb

Git user git at public.arvados.org
Mon Dec 9 21:38:50 UTC 2019


        at  5abaf7eeb3438eb6d9f81b02c6d5ccbff29b3184 (commit)


commit 5abaf7eeb3438eb6d9f81b02c6d5ccbff29b3184
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Mon Dec 9 16:36:23 2019 -0500

    15922: Preserve writable_by in user and collection responses.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/lib/controller/federation/conn.go b/lib/controller/federation/conn.go
index 887102f8e..736ecda29 100644
--- a/lib/controller/federation/conn.go
+++ b/lib/controller/federation/conn.go
@@ -345,6 +345,7 @@ var userAttrsCachedFromLoginCluster = map[string]bool{
 	"is_invited":   false,
 	"owner_uuid":   false,
 	"uuid":         false,
+	"writable_by":  false,
 }
 
 func (conn *Conn) UserList(ctx context.Context, options arvados.ListOptions) (arvados.UserList, error) {
diff --git a/lib/controller/router/response.go b/lib/controller/router/response.go
index e3ec37a6e..7e1b70249 100644
--- a/lib/controller/router/response.go
+++ b/lib/controller/router/response.go
@@ -45,9 +45,11 @@ func applySelectParam(selectParam []string, orig map[string]interface{}) map[str
 			selected[attr] = v
 		}
 	}
-	// Preserve "kind" even if not requested
-	if v, ok := orig["kind"]; ok {
-		selected["kind"] = v
+	// Some keys are always preserved, even if not requested
+	for _, k := range []string{"kind", "writable_by"} {
+		if v, ok := orig[k]; ok {
+			selected[k] = v
+		}
 	}
 	return selected
 }
diff --git a/sdk/go/arvados/collection.go b/sdk/go/arvados/collection.go
index e8b0f9cc9..40195e11d 100644
--- a/sdk/go/arvados/collection.go
+++ b/sdk/go/arvados/collection.go
@@ -36,6 +36,7 @@ type Collection struct {
 	DeleteAt                  *time.Time             `json:"delete_at"`
 	IsTrashed                 bool                   `json:"is_trashed"`
 	Properties                map[string]interface{} `json:"properties"`
+	WritableBy                []string               `json:"writable_by,omitempty"`
 }
 
 func (c Collection) resourceName() string {
diff --git a/sdk/go/arvados/user.go b/sdk/go/arvados/user.go
index 30bc094d0..950b2ff4e 100644
--- a/sdk/go/arvados/user.go
+++ b/sdk/go/arvados/user.go
@@ -24,6 +24,7 @@ type User struct {
 	ModifiedByUserUUID   string                 `json:"modified_by_user_uuid"`
 	ModifiedByClientUUID string                 `json:"modified_by_client_uuid"`
 	Prefs                map[string]interface{} `json:"prefs"`
+	WritableBy           []string               `json:"writable_by,omitempty"`
 }
 
 // UserList is an arvados#userList resource.

commit 2750881871a4f14295d704ec8d1af04fa325e638
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Mon Dec 9 09:51:55 2019 -0500

    15922: Accept HEAD method on all GET routes.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/lib/controller/router/router.go b/lib/controller/router/router.go
index a9ed8cab4..b2e3bd006 100644
--- a/lib/controller/router/router.go
+++ b/lib/controller/router/router.go
@@ -298,12 +298,6 @@ func (rtr *router) addRoutes() {
 		},
 	} {
 		rtr.addRoute(route.endpoint, route.defaultOpts, route.exec)
-		if route.endpoint.Method == "PATCH" {
-			// Accept PUT as a synonym for PATCH.
-			endpointPUT := route.endpoint
-			endpointPUT.Method = "PUT"
-			rtr.addRoute(endpointPUT, route.defaultOpts, route.exec)
-		}
 	}
 	rtr.mux.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 		httpserver.Errors(w, []string{"API endpoint not found"}, http.StatusNotFound)
@@ -313,8 +307,17 @@ func (rtr *router) addRoutes() {
 	})
 }
 
+var altMethod = map[string]string{
+	"PATCH": "PUT",  // Accept PUT as a synonym for PATCH
+	"GET":   "HEAD", // Accept HEAD at any GET route
+}
+
 func (rtr *router) addRoute(endpoint arvados.APIEndpoint, defaultOpts func() interface{}, exec routableFunc) {
-	rtr.mux.Methods(endpoint.Method).Path("/" + endpoint.Path).HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
+	methods := []string{endpoint.Method}
+	if alt, ok := altMethod[endpoint.Method]; ok {
+		methods = append(methods, alt)
+	}
+	rtr.mux.Methods(methods...).Path("/" + endpoint.Path).HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 		logger := ctxlog.FromContext(req.Context())
 		params, err := rtr.loadRequestParams(req, endpoint.AttrsKey)
 		if err != nil {
diff --git a/lib/controller/router/router_test.go b/lib/controller/router/router_test.go
index 701d53a26..c951cdec8 100644
--- a/lib/controller/router/router_test.go
+++ b/lib/controller/router/router_test.go
@@ -329,6 +329,11 @@ func (s *RouterIntegrationSuite) TestSelectParam(c *check.C) {
 	}
 }
 
+func (s *RouterIntegrationSuite) TestHEAD(c *check.C) {
+	_, rr, _ := doRequest(c, s.rtr, arvadostest.ActiveTokenV2, "HEAD", "/arvados/v1/containers/"+arvadostest.QueuedContainerUUID, nil, nil)
+	c.Check(rr.Code, check.Equals, http.StatusOK)
+}
+
 func (s *RouterIntegrationSuite) TestRouteNotFound(c *check.C) {
 	token := arvadostest.ActiveTokenV2
 	req := (&testReq{
diff --git a/services/keepproxy/keepproxy_test.go b/services/keepproxy/keepproxy_test.go
index 00dd3c317..b67e6febb 100644
--- a/services/keepproxy/keepproxy_test.go
+++ b/services/keepproxy/keepproxy_test.go
@@ -142,6 +142,7 @@ func (s *ServerRequiredSuite) TestResponseViaHeader(c *C) {
 	resp, err := (&http.Client{}).Do(req)
 	c.Assert(err, Equals, nil)
 	c.Check(resp.Header.Get("Via"), Equals, "HTTP/1.1 keepproxy")
+	c.Assert(resp.StatusCode, Equals, http.StatusOK)
 	locator, err := ioutil.ReadAll(resp.Body)
 	c.Assert(err, Equals, nil)
 	resp.Body.Close()

commit 2850a5cb4b2ea90324389b0ab537e324f480868d
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Sat Dec 7 19:48:50 2019 -0500

    15922: Change EnableBetaController14287 -> ForceLegacyAPI14.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/lib/config/config.default.yml b/lib/config/config.default.yml
index 98e6bd372..7779d7ebf 100644
--- a/lib/config/config.default.yml
+++ b/lib/config/config.default.yml
@@ -512,7 +512,7 @@ Clusters:
       # "https://zzzzz.example.com/login") as an authorized redirect
       # URL.
       #
-      # Requires EnableBetaController14287. ProviderAppID must be
+      # Incompatible with ForceLegacyAPI14. ProviderAppID must be
       # blank.
       GoogleClientID: ""
       GoogleClientSecret: ""
@@ -1109,5 +1109,9 @@ Clusters:
         <p>An administrator must activate your account before you can get
         any further.</p>
 
-    # Use experimental controller code (see https://dev.arvados.org/issues/14287)
-    EnableBetaController14287: false
+    # Bypass new (Arvados 1.5) API implementations, and hand off
+    # requests directly to Rails instead. This can provide a temporary
+    # workaround for clients that are incompatible with the new API
+    # implementation. Note that it also disables some new federation
+    # features and will be removed in a future release.
+    ForceLegacyAPI14: false
diff --git a/lib/config/export.go b/lib/config/export.go
index 413ff9578..22d7a626e 100644
--- a/lib/config/export.go
+++ b/lib/config/export.go
@@ -124,7 +124,7 @@ var whitelist = map[string]bool{
 	"Containers.SupportedDockerImageFormats":       true,
 	"Containers.SupportedDockerImageFormats.*":     true,
 	"Containers.UsePreemptibleInstances":           true,
-	"EnableBetaController14287":                    false,
+	"ForceLegacyAPI14":                             false,
 	"Git":                                          false,
 	"InstanceTypes":                                true,
 	"InstanceTypes.*":                              true,
diff --git a/lib/config/generated_config.go b/lib/config/generated_config.go
index ece3a627f..3e58d249b 100644
--- a/lib/config/generated_config.go
+++ b/lib/config/generated_config.go
@@ -518,7 +518,7 @@ Clusters:
       # "https://zzzzz.example.com/login") as an authorized redirect
       # URL.
       #
-      # Requires EnableBetaController14287. ProviderAppID must be
+      # Incompatible with ForceLegacyAPI14. ProviderAppID must be
       # blank.
       GoogleClientID: ""
       GoogleClientSecret: ""
@@ -1115,6 +1115,10 @@ Clusters:
         <p>An administrator must activate your account before you can get
         any further.</p>
 
-    # Use experimental controller code (see https://dev.arvados.org/issues/14287)
-    EnableBetaController14287: false
+    # Bypass new (Arvados 1.5) API implementations, and hand off
+    # requests directly to Rails instead. This can provide a temporary
+    # workaround for clients that are incompatible with the new API
+    # implementation. Note that it also disables some new federation
+    # features and will be removed in a future release.
+    ForceLegacyAPI14: false
 `)
diff --git a/lib/controller/federation_test.go b/lib/controller/federation_test.go
index c654277fe..903465c43 100644
--- a/lib/controller/federation_test.go
+++ b/lib/controller/federation_test.go
@@ -57,9 +57,9 @@ func (s *FederationSuite) SetUpTest(c *check.C) {
 	c.Assert(s.remoteMock.Start(), check.IsNil)
 
 	cluster := &arvados.Cluster{
-		ClusterID:                 "zhome",
-		PostgreSQL:                integrationTestCluster().PostgreSQL,
-		EnableBetaController14287: enableBetaController14287,
+		ClusterID:        "zhome",
+		PostgreSQL:       integrationTestCluster().PostgreSQL,
+		ForceLegacyAPI14: forceLegacyAPI14,
 	}
 	cluster.TLS.Insecure = true
 	cluster.API.MaxItemsPerResponse = 1000
diff --git a/lib/controller/handler.go b/lib/controller/handler.go
index a0c245009..2694a07f7 100644
--- a/lib/controller/handler.go
+++ b/lib/controller/handler.go
@@ -80,7 +80,7 @@ func (h *Handler) setup() {
 	rtr := router.New(federation.New(h.Cluster))
 	mux.Handle("/arvados/v1/config", rtr)
 
-	if h.Cluster.EnableBetaController14287 {
+	if !h.Cluster.ForceLegacyAPI14 {
 		mux.Handle("/arvados/v1/collections", rtr)
 		mux.Handle("/arvados/v1/collections/", rtr)
 		mux.Handle("/arvados/v1/users", rtr)
diff --git a/lib/controller/handler_test.go b/lib/controller/handler_test.go
index ebadc5d02..c43744f90 100644
--- a/lib/controller/handler_test.go
+++ b/lib/controller/handler_test.go
@@ -23,11 +23,11 @@ import (
 	check "gopkg.in/check.v1"
 )
 
-var enableBetaController14287 bool
+var forceLegacyAPI14 bool
 
 // Gocheck boilerplate
 func Test(t *testing.T) {
-	for _, enableBetaController14287 = range []bool{false, true} {
+	for _, forceLegacyAPI14 = range []bool{false, true} {
 		check.TestingT(t)
 	}
 }
@@ -45,10 +45,9 @@ func (s *HandlerSuite) SetUpTest(c *check.C) {
 	s.ctx, s.cancel = context.WithCancel(context.Background())
 	s.ctx = ctxlog.Context(s.ctx, ctxlog.New(os.Stderr, "json", "debug"))
 	s.cluster = &arvados.Cluster{
-		ClusterID:  "zzzzz",
-		PostgreSQL: integrationTestCluster().PostgreSQL,
-
-		EnableBetaController14287: enableBetaController14287,
+		ClusterID:        "zzzzz",
+		PostgreSQL:       integrationTestCluster().PostgreSQL,
+		ForceLegacyAPI14: forceLegacyAPI14,
 	}
 	s.cluster.TLS.Insecure = true
 	arvadostest.SetServiceURL(&s.cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
diff --git a/lib/controller/server_test.go b/lib/controller/server_test.go
index edc5fd117..9c106aab8 100644
--- a/lib/controller/server_test.go
+++ b/lib/controller/server_test.go
@@ -35,10 +35,9 @@ func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server {
 	log := ctxlog.TestLogger(c)
 
 	handler := &Handler{Cluster: &arvados.Cluster{
-		ClusterID:  "zzzzz",
-		PostgreSQL: integrationTestCluster().PostgreSQL,
-
-		EnableBetaController14287: enableBetaController14287,
+		ClusterID:        "zzzzz",
+		PostgreSQL:       integrationTestCluster().PostgreSQL,
+		ForceLegacyAPI14: forceLegacyAPI14,
 	}}
 	handler.Cluster.TLS.Insecure = true
 	arvadostest.SetServiceURL(&handler.Cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go
index 72128a9dc..dc868a15b 100644
--- a/sdk/go/arvados/config.go
+++ b/sdk/go/arvados/config.go
@@ -215,7 +215,7 @@ type Cluster struct {
 		InactivePageHTML       string
 	}
 
-	EnableBetaController14287 bool
+	ForceLegacyAPI14 bool
 }
 
 type Volume struct {
diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index dd74df236..2e093b396 100644
--- a/sdk/python/tests/run_test_server.py
+++ b/sdk/python/tests/run_test_server.py
@@ -717,7 +717,6 @@ def setup_config():
     config = {
         "Clusters": {
             "zzzzz": {
-                "EnableBetaController14287": ('14287' in os.environ.get('ARVADOS_EXPERIMENTAL', '')),
                 "ManagementToken": "e687950a23c3a9bceec28c6223a06c79",
                 "SystemRootToken": auth_token('system_user'),
                 "API": {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list