[ARVADOS] updated: 2.1.0-446-gb132d9f49

Git user git at public.arvados.org
Fri Feb 26 22:49:50 UTC 2021


Summary of changes:
 lib/controller/rpc/conn.go                         | 18 ++++++++++++++--
 .../controllers/arvados/v1/groups_controller.rb    | 25 ++++++++++++++++++----
 2 files changed, 37 insertions(+), 6 deletions(-)

  discards  3c6bd20ffd59492548c0608943518cb2b4325054 (commit)
       via  b132d9f49fcca047d8092ad5ee5735a531a6bc23 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (3c6bd20ffd59492548c0608943518cb2b4325054)
            \
             N -- N -- N (b132d9f49fcca047d8092ad5ee5735a531a6bc23)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 b132d9f49fcca047d8092ad5ee5735a531a6bc23
Author: Ward Vandewege <ward at curii.com>
Date:   Fri Feb 26 11:19:57 2021 -0500

    17119: make controller understand filter groups.
    
    Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>

diff --git a/lib/controller/rpc/conn.go b/lib/controller/rpc/conn.go
index b3713d938..7e85b3dae 100644
--- a/lib/controller/rpc/conn.go
+++ b/lib/controller/rpc/conn.go
@@ -23,6 +23,7 @@ import (
 
 	"git.arvados.org/arvados.git/sdk/go/arvados"
 	"git.arvados.org/arvados.git/sdk/go/auth"
+	"git.arvados.org/arvados.git/sdk/go/ctxlog"
 	"git.arvados.org/arvados.git/sdk/go/httpserver"
 )
 
@@ -445,9 +446,38 @@ func (conn *Conn) GroupList(ctx context.Context, options arvados.ListOptions) (a
 }
 
 func (conn *Conn) GroupContents(ctx context.Context, options arvados.GroupContentsOptions) (arvados.ObjectList, error) {
-	ep := arvados.EndpointGroupContents
+	log := ctxlog.FromContext(ctx)
 	var resp arvados.ObjectList
-	err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
+
+	// Get the group object
+	epGet := arvados.EndpointGroupGet
+	var respGroup arvados.Group
+	err := conn.requestAndDecode(ctx, &respGroup, epGet, nil, options)
+	if err != nil {
+		return resp, err
+	}
+
+	// If the group has groupClass 'filter', apply the filters before getting the contents.
+	if respGroup.GroupClass == "filter" {
+		if filters, ok := respGroup.Properties["filters"]; ok {
+			for _, f := range filters.([]interface{}) {
+				// f is supposed to be a []string
+				tmp, ok2 := f.([]interface{})
+				if !ok2 || len(tmp) < 3 {
+					log.Warnf("filter unparsable: %T, %+v, original field: %T, %+v\n", tmp, tmp, f, f)
+					continue
+				}
+				var filter arvados.Filter
+				filter.Attr = tmp[0].(string)
+				filter.Operator = tmp[1].(string)
+				filter.Operand = tmp[2]
+				options.Filters = append(options.Filters, filter)
+			}
+		}
+	}
+
+	ep := arvados.EndpointGroupContents
+	err = conn.requestAndDecode(ctx, &resp, ep, nil, options)
 	return resp, err
 }
 
diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index 394b5603b..8e10dced5 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -227,12 +227,29 @@ class Arvados::V1::GroupsController < ApplicationController
       end
     end
 
+    # filter groups need to be limited to those classes mentioned in the filters
+    if @object and @object.group_class == "filter"
+      if request_filters.length() == 0
+        raise ArgumentError.new("Filter group needs to have filters defined")
+      end
+      request_filters.each do |col, op, val|
+        if col.index('.')
+          col = col.split('.')[0]
+          col = col.capitalize.sub(/s$/,'')
+          wanted_klasses << col
+        end
+      end
+    end
+
     filter_by_owner = {}
     if @object
-      if params['recursive']
-        filter_by_owner[:owner_uuid] = [@object.uuid] + @object.descendant_project_uuids
-      else
-        filter_by_owner[:owner_uuid] = @object.uuid
+      # filter groups should not have an owner_uuid filter applied
+      if @object.group_class != "filter"
+        if params['recursive']
+          filter_by_owner[:owner_uuid] = [@object.uuid] + @object.descendant_project_uuids
+        else
+          filter_by_owner[:owner_uuid] = @object.uuid
+        end
       end
 
       if params['exclude_home_project']

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list