[ARVADOS] updated: 1.3.0-3086-g47aa52f1b
Git user
git at public.arvados.org
Fri Sep 4 14:52:55 UTC 2020
Summary of changes:
lib/controller/federation/conn.go | 53 +++++++++++++++++---------------------
lib/controller/integration_test.go | 5 ++--
2 files changed, 26 insertions(+), 32 deletions(-)
via 47aa52f1b343c93e09908b69d40bf8b389e8b15c (commit)
from 51d7a5b2a23074a130aa6dd74cbaf5f335920769 (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 47aa52f1b343c93e09908b69d40bf8b389e8b15c
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Fri Sep 4 10:52:38 2020 -0400
16778: Simplify logic
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/lib/controller/federation/conn.go b/lib/controller/federation/conn.go
index b2d158b9a..a84f1b017 100644
--- a/lib/controller/federation/conn.go
+++ b/lib/controller/federation/conn.go
@@ -474,40 +474,35 @@ func (conn *Conn) UserActivate(ctx context.Context, options arvados.UserActivate
}
func (conn *Conn) UserSetup(ctx context.Context, options arvados.UserSetupOptions) (map[string]interface{}, error) {
- var setupVM string
- var setupRepo string
- if conn.cluster.Login.LoginCluster != "" {
- if options.VMUUID != "" && options.VMUUID[0:5] != options.UUID[0:5] {
- // When LoginCluster is in effect, and we're
- // setting up a remote user, and we want to
- // give that user access to a local VM, then
- // we need to set up the user on the remote
- // LoginCluster first, followed by calling
- // setup on the local instance to give access
- // to the VM.
- setupVM = options.VMUUID
- options.VMUUID = ""
- }
- if options.RepoName != "" {
- // Similarly, if we want to create a git repo,
- // it should be created on the local cluster,
- // not the remote one.
- setupRepo = options.RepoName
- options.RepoName = ""
+ upstream := conn.localOrLoginCluster()
+ if upstream != conn.local {
+ // When LoginCluster is in effect, and we're setting
+ // up a remote user, and we want to give that user
+ // access to a local VM, we can't include the VM in
+ // the setup call, because the remote cluster won't
+ // recognize it.
+
+ // Similarly, if we want to create a git repo,
+ // it should be created on the local cluster,
+ // not the remote one.
+
+ setupVM := options.VMUUID
+ setupRepo := options.RepoName
+ options.VMUUID = ""
+ options.RepoName = ""
+
+ ret, err := upstream.UserSetup(ctx, options)
+ if err != nil {
+ return ret, err
}
- }
- ret, err := conn.localOrLoginCluster().UserSetup(ctx, options)
- if err != nil {
- return ret, err
- }
-
- if setupVM != "" || setupRepo != "" {
+ // Restore VMUUID and RepoName for the call to local
+ // UserSetup below.
options.VMUUID = setupVM
options.RepoName = setupRepo
- ret, err = conn.local.UserSetup(ctx, options)
}
- return ret, err
+
+ return conn.local.UserSetup(ctx, options)
}
func (conn *Conn) UserUnsetup(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
diff --git a/lib/controller/integration_test.go b/lib/controller/integration_test.go
index 90d1c3f17..077493ffc 100644
--- a/lib/controller/integration_test.go
+++ b/lib/controller/integration_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"context"
"encoding/json"
- "fmt"
"io"
"math"
"net"
@@ -305,7 +304,7 @@ func (s *IntegrationSuite) TestGetCollectionAsAnonymous(c *check.C) {
c.Check(err, check.IsNil)
// Make a v2 token of the z3 anonymous user, and use it on z1
- _, anonac1, _ := s.clientsWithToken("z1111", fmt.Sprintf("v2/%v/%v", outAuth.UUID, outAuth.APIToken))
+ _, anonac1, _ := s.clientsWithToken("z1111", outAuth.TokenV2())
outUser2, err := anonac1.CurrentUser()
c.Check(err, check.IsNil)
// z3 anonymous user will be mapped to the z1 anonymous user
@@ -472,7 +471,7 @@ func (s *IntegrationSuite) TestSetupUserWithVM(c *check.C) {
c.Check(err, check.IsNil)
// Make a v2 root token to communicate with z3333
- rootctx3, rootac3, _ := s.clientsWithToken("z3333", fmt.Sprintf("v2/%v/%v", outAuth.UUID, outAuth.APIToken))
+ rootctx3, rootac3, _ := s.clientsWithToken("z3333", outAuth.TokenV2())
// Create VM on z3333
var outVM arvados.VirtualMachine
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list