[ARVADOS] updated: 2.1.0-446-gc1adfa740

Git user git at public.arvados.org
Tue Mar 2 15:55:20 UTC 2021


Summary of changes:
 lib/controller/rpc/conn.go | 9 +++++++++
 1 file changed, 9 insertions(+)

  discards  5a610f5e90a0c2370e109b4dce4ec612cf27a795 (commit)
       via  c1adfa7409d8f5186a93df589ea8ad9b1eb6414e (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 (5a610f5e90a0c2370e109b4dce4ec612cf27a795)
            \
             N -- N -- N (c1adfa7409d8f5186a93df589ea8ad9b1eb6414e)

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 c1adfa7409d8f5186a93df589ea8ad9b1eb6414e
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..0d963ba58 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,47 @@ 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
+	// The requested UUID can be a user (virtual home project), which we just pass on to
+	// the API server.
+	if strings.Index("j7d0g", options.UUID) != 6 {
+		ep := arvados.EndpointGroupContents
+		var resp arvados.ObjectList
+		err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
+		return resp, err
+	}
+
+	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..79d7b2fb5 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -227,12 +227,30 @@ class Arvados::V1::GroupsController < ApplicationController
       end
     end
 
+    # filter groups need to be limited to those classes mentioned in the filters
+    # @object can also be a User object (virtual home project)
+    if @object and @object.is_a?(Group) 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.is_a?(Group) or (@object.is_a?(Group) and @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