[ARVADOS] updated: 2.1.0-105-g096c4dcbb

Git user git at public.arvados.org
Wed Nov 18 20:36:44 UTC 2020


Summary of changes:
 lib/controller/router/response.go | 83 ++++++++++++++++++++-------------------
 sdk/go/arvados/container.go       |  2 +-
 2 files changed, 44 insertions(+), 41 deletions(-)

       via  096c4dcbbcabbfac7b41f0ebb1a2c52b66341a65 (commit)
       via  69221de9db77ccb68f8d744e5d2dceeef963ae36 (commit)
      from  5ba51e655dc64f55e2c21bd0031ef1a830576667 (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 096c4dcbbcabbfac7b41f0ebb1a2c52b66341a65
Author: Nico Cesar <nico at nicocesar.com>
Date:   Wed Nov 18 15:35:36 2020 -0500

    17014: making cr.container_uuid a string
    
    Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico at curii.com>

diff --git a/lib/controller/router/response.go b/lib/controller/router/response.go
index 8d143cf6c..6c578e0a1 100644
--- a/lib/controller/router/response.go
+++ b/lib/controller/router/response.go
@@ -164,7 +164,11 @@ func (rtr *router) mungeItemFields(tmp map[string]interface{}) {
 				if err != nil {
 					break
 				}
-				tmp[k] = t.Format(rfc3339NanoFixed)
+				if t.IsZero() {
+					tmp[k] = nil
+				} else {
+					tmp[k] = t.Format(rfc3339NanoFixed)
+				}
 			}
 		}
 		switch k {
@@ -175,17 +179,10 @@ func (rtr *router) mungeItemFields(tmp map[string]interface{}) {
 		// as a first step, we'll just try to return the same that railsapi. In the future,
 		// when railsapi is not used anymore, this could all be changed to return whatever we define
 		// in the specification.
-		case "output_uuid", "output_name", "log_uuid", "description", "requesting_container_uuid":
+		case "output_uuid", "output_name", "log_uuid", "description", "requesting_container_uuid", "container_uuid":
 			if v == "" {
 				tmp[k] = nil
 			}
-		case "expires_at":
-			// For some reason this case isn't covered by the "case time.Time" above.
-			// easy to change the code and test it with:
-			// test lib/controller -gocheck.f TestGetObjects
-			if tmp[k] == "0001-01-01T00:00:00.000000000Z" {
-				tmp[k] = nil
-			}
 		case "container_count_max":
 			if v == float64(0) {
 				tmp[k] = nil
diff --git a/sdk/go/arvados/container.go b/sdk/go/arvados/container.go
index 203b426c9..d5f0b5bb1 100644
--- a/sdk/go/arvados/container.go
+++ b/sdk/go/arvados/container.go
@@ -48,7 +48,7 @@ type ContainerRequest struct {
 	Properties              map[string]interface{} `json:"properties"`
 	State                   ContainerRequestState  `json:"state"`
 	RequestingContainerUUID string                 `json:"requesting_container_uuid"`
-	ContainerUUID           *string                `json:"container_uuid"`
+	ContainerUUID           string                 `json:"container_uuid"`
 	ContainerCountMax       int                    `json:"container_count_max"`
 	Mounts                  map[string]Mount       `json:"mounts"`
 	RuntimeConstraints      RuntimeConstraints     `json:"runtime_constraints"`

commit 69221de9db77ccb68f8d744e5d2dceeef963ae36
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Wed Nov 18 15:04:28 2020 -0500

    17014: Munge list items in controller responses.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/lib/controller/router/response.go b/lib/controller/router/response.go
index c1f44eec3..8d143cf6c 100644
--- a/lib/controller/router/response.go
+++ b/lib/controller/router/response.go
@@ -97,15 +97,51 @@ func (rtr *router) sendResponse(w http.ResponseWriter, req *http.Request, resp i
 			} else if defaultItemKind != "" {
 				item["kind"] = defaultItemKind
 			}
-			items[i] = applySelectParam(opts.Select, item)
+			item = applySelectParam(opts.Select, item)
+			rtr.mungeItemFields(item)
+			items[i] = item
 		}
 		if opts.Count == "none" {
 			delete(tmp, "items_available")
 		}
 	} else {
 		tmp = applySelectParam(opts.Select, tmp)
+		rtr.mungeItemFields(tmp)
 	}
 
+	w.Header().Set("Content-Type", "application/json")
+	enc := json.NewEncoder(w)
+	enc.SetEscapeHTML(false)
+	enc.Encode(tmp)
+}
+
+func (rtr *router) sendError(w http.ResponseWriter, err error) {
+	code := http.StatusInternalServerError
+	if err, ok := err.(interface{ HTTPStatus() int }); ok {
+		code = err.HTTPStatus()
+	}
+	httpserver.Error(w, err.Error(), code)
+}
+
+var infixMap = map[string]interface{}{
+	"4zz18": arvados.Collection{},
+	"j7d0g": arvados.Group{},
+}
+
+var mungeKind = regexp.MustCompile(`\..`)
+
+func kind(resp interface{}) string {
+	t := fmt.Sprintf("%T", resp)
+	if !strings.HasPrefix(t, "arvados.") {
+		return ""
+	}
+	return mungeKind.ReplaceAllStringFunc(t, func(s string) string {
+		// "arvados.CollectionList" => "arvados#collectionList"
+		return "#" + strings.ToLower(s[1:])
+	})
+}
+
+func (rtr *router) mungeItemFields(tmp map[string]interface{}) {
 	for k, v := range tmp {
 		if strings.HasSuffix(k, "_at") {
 			// Format non-nil timestamps as
@@ -156,34 +192,4 @@ func (rtr *router) sendResponse(w http.ResponseWriter, req *http.Request, resp i
 			}
 		}
 	}
-	w.Header().Set("Content-Type", "application/json")
-	enc := json.NewEncoder(w)
-	enc.SetEscapeHTML(false)
-	enc.Encode(tmp)
-}
-
-func (rtr *router) sendError(w http.ResponseWriter, err error) {
-	code := http.StatusInternalServerError
-	if err, ok := err.(interface{ HTTPStatus() int }); ok {
-		code = err.HTTPStatus()
-	}
-	httpserver.Error(w, err.Error(), code)
-}
-
-var infixMap = map[string]interface{}{
-	"4zz18": arvados.Collection{},
-	"j7d0g": arvados.Group{},
-}
-
-var mungeKind = regexp.MustCompile(`\..`)
-
-func kind(resp interface{}) string {
-	t := fmt.Sprintf("%T", resp)
-	if !strings.HasPrefix(t, "arvados.") {
-		return ""
-	}
-	return mungeKind.ReplaceAllStringFunc(t, func(s string) string {
-		// "arvados.CollectionList" => "arvados#collectionList"
-		return "#" + strings.ToLower(s[1:])
-	})
 }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list