[ARVADOS] created: 1.1.4-134-g50732d2

Git user git at public.curoverse.com
Mon Apr 23 09:15:44 EDT 2018


        at  50732d226e8ae6a1587fcddf99bdd92712b7297c (commit)


commit 50732d226e8ae6a1587fcddf99bdd92712b7297c
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Mon Apr 23 09:05:39 2018 -0400

    13111: Access projects via /by_id/$uuid/.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/sdk/go/arvados/fs_site.go b/sdk/go/arvados/fs_site.go
index b5daf7b..82114e2 100644
--- a/sdk/go/arvados/fs_site.go
+++ b/sdk/go/arvados/fs_site.go
@@ -6,6 +6,7 @@ package arvados
 
 import (
 	"os"
+	"strings"
 	"sync"
 	"time"
 )
@@ -60,7 +61,7 @@ func (fs *customFileSystem) MountByID(mount string) {
 					mode:    0755 | os.ModeDir,
 				},
 			},
-			create: fs.mountCollection,
+			create: fs.mountByID,
 		}, nil
 	})
 }
@@ -123,6 +124,16 @@ func (fs *customFileSystem) newNode(name string, perm os.FileMode, modTime time.
 	return nil, ErrInvalidOperation
 }
 
+func (fs *customFileSystem) mountByID(parent inode, id string) inode {
+	if strings.Contains(id, "-4zz18-") || pdhRegexp.MatchString(id) {
+		return fs.mountCollection(parent, id)
+	} else if strings.Contains(id, "-j7d0g-") {
+		return fs.newProjectNode(fs.root, id, id)
+	} else {
+		return nil
+	}
+}
+
 func (fs *customFileSystem) mountCollection(parent inode, id string) inode {
 	var coll Collection
 	err := fs.RequestAndDecode(&coll, "GET", "arvados/v1/collections/"+id, nil, nil)
diff --git a/sdk/go/arvados/fs_site_test.go b/sdk/go/arvados/fs_site_test.go
index e35ae48..a8e23e5 100644
--- a/sdk/go/arvados/fs_site_test.go
+++ b/sdk/go/arvados/fs_site_test.go
@@ -7,6 +7,7 @@ package arvados
 import (
 	"net/http"
 	"os"
+	"path/filepath"
 
 	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
 	check "gopkg.in/check.v1"
@@ -45,7 +46,7 @@ func (s *SiteFSSuite) TestByIDEmpty(c *check.C) {
 	c.Check(len(fis), check.Equals, 0)
 }
 
-func (s *SiteFSSuite) TestByUUID(c *check.C) {
+func (s *SiteFSSuite) TestByUUIDAndPDH(c *check.C) {
 	f, err := s.fs.Open("/by_id")
 	c.Assert(err, check.IsNil)
 	fis, err := f.Readdir(-1)
@@ -58,14 +59,19 @@ func (s *SiteFSSuite) TestByUUID(c *check.C) {
 	f, err = s.fs.Open("/by_id/" + arvadostest.NonexistentCollection)
 	c.Assert(err, check.Equals, os.ErrNotExist)
 
-	f, err = s.fs.Open("/by_id/" + arvadostest.FooCollection)
-	c.Assert(err, check.IsNil)
-	fis, err = f.Readdir(-1)
-	var names []string
-	for _, fi := range fis {
-		names = append(names, fi.Name())
+	for _, path := range []string{
+		arvadostest.FooCollection,
+		filepath.Join(arvadostest.AProjectUUID, arvadostest.FooCollectionName),
+	} {
+		f, err = s.fs.Open("/by_id/" + path)
+		c.Assert(err, check.IsNil)
+		fis, err = f.Readdir(-1)
+		var names []string
+		for _, fi := range fis {
+			names = append(names, fi.Name())
+		}
+		c.Check(names, check.DeepEquals, []string{"foo"})
 	}
-	c.Check(names, check.DeepEquals, []string{"foo"})
 
 	_, err = s.fs.OpenFile("/by_id/"+arvadostest.NonexistentCollection, os.O_RDWR|os.O_CREATE, 0755)
 	c.Check(err, check.Equals, ErrInvalidOperation)
diff --git a/sdk/go/arvadostest/fixtures.go b/sdk/go/arvadostest/fixtures.go
index 5fccfb3..a434690 100644
--- a/sdk/go/arvadostest/fixtures.go
+++ b/sdk/go/arvadostest/fixtures.go
@@ -16,6 +16,7 @@ const (
 	FederatedActiveUserUUID = "zbbbb-tpzed-xurymjxw79nv3jz"
 	SpectatorUserUUID       = "zzzzz-tpzed-l1s2piq4t4mps8r"
 	UserAgreementCollection = "zzzzz-4zz18-uukreo9rbgwsujr" // user_agreement_in_anonymously_accessible_project
+	FooCollectionName       = "zzzzz-4zz18-fy296fx3hot09f7 added sometime"
 	FooCollection           = "zzzzz-4zz18-fy296fx3hot09f7"
 	FooCollectionPDH        = "1f4b0bc7583c2a7f9102c395f4ffc5e3+45"
 	NonexistentCollection   = "zzzzz-4zz18-totallynotexist"

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list