[ARVADOS] created: 1.3.0-1851-g7716328e4

Git user git at public.curoverse.com
Tue Nov 12 18:07:19 UTC 2019


        at  7716328e40d57599776a703c7113788990aba708 (commit)


commit 7716328e40d57599776a703c7113788990aba708
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Nov 12 14:41:05 2019 -0300

    15642: Fixes legacy config loading for arv-git-httpd.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/lib/config/deprecated.go b/lib/config/deprecated.go
index f1714fa0b..95116ec2e 100644
--- a/lib/config/deprecated.go
+++ b/lib/config/deprecated.go
@@ -460,11 +460,11 @@ const defaultGitHttpdConfigPath = "/etc/arvados/git-httpd/git-httpd.yml"
 
 type oldGitHttpdConfig struct {
 	Client          *arvados.Client
-	Listen          string
-	GitCommand      string
-	GitoliteHome    string
-	RepoRoot        string
-	ManagementToken string
+	Listen          *string
+	GitCommand      *string
+	GitoliteHome    *string
+	RepoRoot        *string
+	ManagementToken *string
 }
 
 func (ldr *Loader) loadOldGitHttpdConfig(cfg *arvados.Config) error {
@@ -486,12 +486,21 @@ func (ldr *Loader) loadOldGitHttpdConfig(cfg *arvados.Config) error {
 
 	loadOldClientConfig(cluster, oc.Client)
 
-	cluster.Services.GitHTTP.InternalURLs[arvados.URL{Host: oc.Listen}] = arvados.ServiceInstance{}
-	cluster.TLS.Insecure = oc.Client.Insecure
-	cluster.ManagementToken = oc.ManagementToken
-	cluster.Git.GitCommand = oc.GitCommand
-	cluster.Git.GitoliteHome = oc.GitoliteHome
-	cluster.Git.Repositories = oc.RepoRoot
+	if oc.Listen != nil {
+		cluster.Services.GitHTTP.InternalURLs[arvados.URL{Host: *oc.Listen}] = arvados.ServiceInstance{}
+	}
+	if oc.ManagementToken != nil {
+		cluster.ManagementToken = *oc.ManagementToken
+	}
+	if oc.GitCommand != nil {
+		cluster.Git.GitCommand = *oc.GitCommand
+	}
+	if oc.GitoliteHome != nil {
+		cluster.Git.GitoliteHome = *oc.GitoliteHome
+	}
+	if oc.RepoRoot != nil {
+		cluster.Git.Repositories = *oc.RepoRoot
+	}
 
 	cfg.Clusters[cluster.ClusterID] = *cluster
 	return nil

commit 05077735f59ec3027c365aeeb270ddc78727ce14
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Nov 12 14:36:47 2019 -0300

    15642: Fixes legacy config loading for keep-web.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/lib/config/deprecated.go b/lib/config/deprecated.go
index 7b11e090e..f1714fa0b 100644
--- a/lib/config/deprecated.go
+++ b/lib/config/deprecated.go
@@ -370,27 +370,27 @@ const defaultKeepWebConfigPath = "/etc/arvados/keep-web/keep-web.yml"
 type oldKeepWebConfig struct {
 	Client *arvados.Client
 
-	Listen string
+	Listen *string
 
-	AnonymousTokens    []string
-	AttachmentOnlyHost string
-	TrustAllContent    bool
+	AnonymousTokens    *[]string
+	AttachmentOnlyHost *string
+	TrustAllContent    *bool
 
 	Cache struct {
-		TTL                  arvados.Duration
-		UUIDTTL              arvados.Duration
-		MaxCollectionEntries int
-		MaxCollectionBytes   int64
-		MaxPermissionEntries int
-		MaxUUIDEntries       int
+		TTL                  *arvados.Duration
+		UUIDTTL              *arvados.Duration
+		MaxCollectionEntries *int
+		MaxCollectionBytes   *int64
+		MaxPermissionEntries *int
+		MaxUUIDEntries       *int
 	}
 
 	// Hack to support old command line flag, which is a bool
 	// meaning "get actual token from environment".
-	deprecatedAllowAnonymous bool
+	deprecatedAllowAnonymous *bool
 
 	// Authorization token to be included in all health check requests.
-	ManagementToken string
+	ManagementToken *string
 }
 
 func (ldr *Loader) loadOldKeepWebConfig(cfg *arvados.Config) error {
@@ -412,22 +412,43 @@ func (ldr *Loader) loadOldKeepWebConfig(cfg *arvados.Config) error {
 
 	loadOldClientConfig(cluster, oc.Client)
 
-	cluster.Services.WebDAV.InternalURLs[arvados.URL{Host: oc.Listen}] = arvados.ServiceInstance{}
-	cluster.Services.WebDAVDownload.InternalURLs[arvados.URL{Host: oc.Listen}] = arvados.ServiceInstance{}
-	cluster.Services.WebDAVDownload.ExternalURL = arvados.URL{Host: oc.AttachmentOnlyHost}
-	cluster.TLS.Insecure = oc.Client.Insecure
-	cluster.ManagementToken = oc.ManagementToken
-	cluster.Collections.TrustAllContent = oc.TrustAllContent
-	cluster.Collections.WebDAVCache.TTL = oc.Cache.TTL
-	cluster.Collections.WebDAVCache.UUIDTTL = oc.Cache.UUIDTTL
-	cluster.Collections.WebDAVCache.MaxCollectionEntries = oc.Cache.MaxCollectionEntries
-	cluster.Collections.WebDAVCache.MaxCollectionBytes = oc.Cache.MaxCollectionBytes
-	cluster.Collections.WebDAVCache.MaxPermissionEntries = oc.Cache.MaxPermissionEntries
-	cluster.Collections.WebDAVCache.MaxUUIDEntries = oc.Cache.MaxUUIDEntries
-	if len(oc.AnonymousTokens) > 0 {
-		cluster.Users.AnonymousUserToken = oc.AnonymousTokens[0]
-		if len(oc.AnonymousTokens) > 1 {
-			ldr.Logger.Warn("More than 1 anonymous tokens configured, using only the first and discarding the rest.")
+	if oc.Listen != nil {
+		cluster.Services.WebDAV.InternalURLs[arvados.URL{Host: *oc.Listen}] = arvados.ServiceInstance{}
+		cluster.Services.WebDAVDownload.InternalURLs[arvados.URL{Host: *oc.Listen}] = arvados.ServiceInstance{}
+	}
+	if oc.AttachmentOnlyHost != nil {
+		cluster.Services.WebDAVDownload.ExternalURL = arvados.URL{Host: *oc.AttachmentOnlyHost}
+	}
+	if oc.ManagementToken != nil {
+		cluster.ManagementToken = *oc.ManagementToken
+	}
+	if oc.TrustAllContent != nil {
+		cluster.Collections.TrustAllContent = *oc.TrustAllContent
+	}
+	if oc.Cache.TTL != nil {
+		cluster.Collections.WebDAVCache.TTL = *oc.Cache.TTL
+	}
+	if oc.Cache.UUIDTTL != nil {
+		cluster.Collections.WebDAVCache.UUIDTTL = *oc.Cache.UUIDTTL
+	}
+	if oc.Cache.MaxCollectionEntries != nil {
+		cluster.Collections.WebDAVCache.MaxCollectionEntries = *oc.Cache.MaxCollectionEntries
+	}
+	if oc.Cache.MaxCollectionBytes != nil {
+		cluster.Collections.WebDAVCache.MaxCollectionBytes = *oc.Cache.MaxCollectionBytes
+	}
+	if oc.Cache.MaxPermissionEntries != nil {
+		cluster.Collections.WebDAVCache.MaxPermissionEntries = *oc.Cache.MaxPermissionEntries
+	}
+	if oc.Cache.MaxUUIDEntries != nil {
+		cluster.Collections.WebDAVCache.MaxUUIDEntries = *oc.Cache.MaxUUIDEntries
+	}
+	if oc.AnonymousTokens != nil {
+		if len(*oc.AnonymousTokens) > 0 {
+			cluster.Users.AnonymousUserToken = (*oc.AnonymousTokens)[0]
+			if len(*oc.AnonymousTokens) > 1 {
+				ldr.Logger.Warn("More than 1 anonymous tokens configured, using only the first and discarding the rest.")
+			}
 		}
 	}
 

commit 9294e4624a4ee682256db95e371a4429a2313b1e
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Nov 12 15:06:02 2019 -0300

    15642: Adds tests exposing the bug.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/lib/config/deprecated_test.go b/lib/config/deprecated_test.go
index ff1bb9434..845c73c05 100644
--- a/lib/config/deprecated_test.go
+++ b/lib/config/deprecated_test.go
@@ -15,6 +15,9 @@ import (
 	check "gopkg.in/check.v1"
 )
 
+// Configured at: sdk/python/tests/run_test_server.py
+const TestServerManagementToken = "e687950a23c3a9bceec28c6223a06c79"
+
 func testLoadLegacyConfig(content []byte, mungeFlag string, c *check.C) (*arvados.Cluster, error) {
 	tmpfile, err := ioutil.TempFile("", "example")
 	if err != nil {
@@ -133,6 +136,23 @@ func (s *LoadSuite) TestLegacyKeepWebConfig(c *check.C) {
 	c.Check(cluster.ManagementToken, check.Equals, "xyzzy")
 }
 
+// Tests fix for https://dev.arvados.org/issues/15642
+func (s *LoadSuite) TestLegacyKeepWebConfigDoesntDisableMissingItems(c *check.C) {
+	content := []byte(`
+{
+	"Client": {
+		"Scheme": "",
+		"APIHost": "example.com",
+		"AuthToken": "abcdefg",
+	}
+}
+`)
+	cluster, err := testLoadLegacyConfig(content, "-legacy-keepweb-config", c)
+	c.Check(err, check.IsNil)
+	// The resulting ManagementToken should be the one set up on the test server.
+	c.Check(cluster.ManagementToken, check.Equals, TestServerManagementToken)
+}
+
 func (s *LoadSuite) TestLegacyKeepproxyConfig(c *check.C) {
 	f := "-legacy-keepproxy-config"
 	content := []byte(fmtKeepproxyConfig("", true))
@@ -217,6 +237,23 @@ func (s *LoadSuite) TestLegacyArvGitHttpdConfig(c *check.C) {
 	c.Check(cluster.Services.Keepproxy.InternalURLs[arvados.URL{Host: ":9000"}], check.Equals, arvados.ServiceInstance{})
 }
 
+// Tests fix for https://dev.arvados.org/issues/15642
+func (s *LoadSuite) TestLegacyArvGitHttpdConfigDoesntDisableMissingItems(c *check.C) {
+	content := []byte(`
+{
+	"Client": {
+		"Scheme": "",
+		"APIHost": "example.com",
+		"AuthToken": "abcdefg",
+	}
+}
+`)
+	cluster, err := testLoadLegacyConfig(content, "-legacy-git-httpd-config", c)
+	c.Check(err, check.IsNil)
+	// The resulting ManagementToken should be the one set up on the test server.
+	c.Check(cluster.ManagementToken, check.Equals, TestServerManagementToken)
+}
+
 func (s *LoadSuite) TestLegacyKeepBalanceConfig(c *check.C) {
 	f := "-legacy-keepbalance-config"
 	content := []byte(fmtKeepBalanceConfig(""))

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list