[ARVADOS] updated: 1.3.0-1542-g5ae0a422e

Git user git at public.curoverse.com
Wed Aug 14 19:24:28 UTC 2019


Summary of changes:
 lib/config/deprecated_test.go        | 114 ++++++++++++++++++++++++++---------
 lib/config/load.go                   |   2 +-
 services/keepproxy/keepproxy.go      |  10 +--
 services/keepproxy/keepproxy.service |   1 -
 services/keepproxy/keepproxy_test.go |  72 ----------------------
 5 files changed, 93 insertions(+), 106 deletions(-)

       via  5ae0a422e60788a4039d17d2d8dfb60f250329c7 (commit)
       via  729c7c95d0d9c8d0357143717d5f2bb8cdd743de (commit)
      from  d4ed3e6460469f2766e1f1676c538d6c86e000b6 (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 5ae0a422e60788a4039d17d2d8dfb60f250329c7
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date:   Wed Aug 14 15:23:12 2019 -0400

    14715: Moves legacy config test to lib/config
    
    Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>

diff --git a/lib/config/deprecated_test.go b/lib/config/deprecated_test.go
index 8479842be..76313ebb1 100644
--- a/lib/config/deprecated_test.go
+++ b/lib/config/deprecated_test.go
@@ -6,6 +6,7 @@ package config
 
 import (
 	"flag"
+	"fmt"
 	"io/ioutil"
 	"os"
 	"time"
@@ -14,6 +15,35 @@ import (
 	check "gopkg.in/check.v1"
 )
 
+func testLoadLegacyConfig(content []byte, mungeFlag string, c *check.C) (*arvados.Cluster, error) {
+	tmpfile, err := ioutil.TempFile("", "example")
+	if err != nil {
+		return nil, err
+	}
+	defer os.Remove(tmpfile.Name())
+
+	if _, err := tmpfile.Write(content); err != nil {
+		return nil, err
+	}
+	if err := tmpfile.Close(); err != nil {
+		return nil, err
+	}
+	flags := flag.NewFlagSet("test", flag.ExitOnError)
+	ldr := testLoader(c, "Clusters: {zzzzz: {}}", nil)
+	ldr.SetupFlags(flags)
+	args := ldr.MungeLegacyConfigArgs(ldr.Logger, []string{"-config", tmpfile.Name()}, mungeFlag)
+	flags.Parse(args)
+	cfg, err := ldr.Load()
+	if err != nil {
+		return nil, err
+	}
+	cluster, err := cfg.GetCluster("")
+	if err != nil {
+		return nil, err
+	}
+	return cluster, nil
+}
+
 func (s *LoadSuite) TestDeprecatedNodeProfilesToServices(c *check.C) {
 	hostname, err := os.Hostname()
 	c.Assert(err, check.IsNil)
@@ -81,33 +111,8 @@ func (s *LoadSuite) TestLegacyKeepWebConfig(c *check.C) {
 	"ManagementToken": "xyzzy"
 }
 `)
-	tmpfile, err := ioutil.TempFile("", "example")
-	if err != nil {
-		c.Error(err)
-	}
-	defer os.Remove(tmpfile.Name())
-
-	if _, err := tmpfile.Write(content); err != nil {
-		c.Error(err)
-	}
-	if err := tmpfile.Close(); err != nil {
-		c.Error(err)
-	}
-	flags := flag.NewFlagSet("keep-web", flag.ExitOnError)
-	ldr := testLoader(c, "Clusters: {zzzzz: {}}", nil)
-	ldr.SetupFlags(flags)
-	args := ldr.MungeLegacyConfigArgs(ldr.Logger, []string{"-config", tmpfile.Name()}, "-legacy-keepweb-config")
-	flags.Parse(args)
-	cfg, err := ldr.Load()
-	if err != nil {
-		c.Error(err)
-	}
-	c.Check(cfg, check.NotNil)
-	cluster, err := cfg.GetCluster("")
-	if err != nil {
-		c.Error(err)
-	}
-	c.Check(cluster, check.NotNil)
+	cluster, err := testLoadLegacyConfig(content, "-legacy-keepweb-config", c)
+	c.Check(err, check.IsNil)
 
 	c.Check(cluster.Services.Controller.ExternalURL, check.Equals, arvados.URL{Scheme: "https", Host: "example.com"})
 	c.Check(cluster.SystemRootToken, check.Equals, "abcdefg")
@@ -127,3 +132,58 @@ func (s *LoadSuite) TestLegacyKeepWebConfig(c *check.C) {
 	c.Check(cluster.Users.AnonymousUserToken, check.Equals, "anonusertoken")
 	c.Check(cluster.ManagementToken, check.Equals, "xyzzy")
 }
+
+func (s *LoadSuite) TestLegacyKeepproxyConfig(c *check.C) {
+	f := "-legacy-keepproxy-config"
+	content := []byte(fmtKeepproxyConfig("", true))
+	cluster, err := testLoadLegacyConfig(content, f, c)
+
+	c.Check(err, check.IsNil)
+	c.Check(cluster, check.NotNil)
+	c.Check(cluster.Services.Controller.ExternalURL, check.Equals, arvados.URL{Scheme: "https", Host: "example.com"})
+	c.Check(cluster.SystemRootToken, check.Equals, "abcdefg")
+	c.Check(cluster.ManagementToken, check.Equals, "xyzzy")
+	c.Check(cluster.Services.Keepproxy.InternalURLs[arvados.URL{Host: ":80"}], check.Equals, arvados.ServiceInstance{})
+	c.Check(cluster.Collections.DefaultReplication, check.Equals, 0)
+	c.Check(cluster.API.KeepServiceRequestTimeout.String(), check.Equals, "15s")
+	c.Check(cluster.SystemLogs.LogLevel, check.Equals, "debug")
+
+	content = []byte(fmtKeepproxyConfig("", false))
+	cluster, err = testLoadLegacyConfig(content, f, c)
+	c.Check(cluster.SystemLogs.LogLevel, check.Equals, "info")
+
+	content = []byte(fmtKeepproxyConfig(`"DisableGet": true,`, true))
+	_, err = testLoadLegacyConfig(content, f, c)
+	c.Check(err, check.NotNil)
+
+	content = []byte(fmtKeepproxyConfig(`"DisablePut": true,`, true))
+	_, err = testLoadLegacyConfig(content, f, c)
+	c.Check(err, check.NotNil)
+
+	content = []byte(fmtKeepproxyConfig(`"PIDFile": "test",`, true))
+	_, err = testLoadLegacyConfig(content, f, c)
+	c.Check(err, check.NotNil)
+
+	content = []byte(fmtKeepproxyConfig(`"DisableGet": false, "DisablePut": false, "PIDFile": "",`, true))
+	_, err = testLoadLegacyConfig(content, f, c)
+	c.Check(err, check.IsNil)
+}
+
+func fmtKeepproxyConfig(param string, debugLog bool) string {
+	return fmt.Sprintf(`
+{
+	"Client": {
+		"Scheme": "",
+		"APIHost": "example.com",
+		"AuthToken": "abcdefg",
+		"Insecure": false
+	},
+	"Listen": ":80",
+	"DefaultReplicas": 0,
+	"Timeout": "15s",
+	"Debug": %t,
+	%s
+	"ManagementToken": "xyzzy"
+}
+`, debugLog, param)
+}
diff --git a/services/keepproxy/keepproxy_test.go b/services/keepproxy/keepproxy_test.go
index 609da4f70..d2758cc25 100644
--- a/services/keepproxy/keepproxy_test.go
+++ b/services/keepproxy/keepproxy_test.go
@@ -13,7 +13,6 @@ import (
 	"math/rand"
 	"net/http"
 	"net/http/httptest"
-	"os"
 	"strings"
 	"sync"
 	"testing"
@@ -640,74 +639,3 @@ func (s *ServerRequiredSuite) TestPing(c *C) {
 	c.Check(resp.Code, Equals, 200)
 	c.Assert(resp.Body.String(), Matches, `{"health":"OK"}\n?`)
 }
-
-func (s *NoKeepServerSuite) TestLegacyConfig(c *C) {
-	content := []byte(fmtConfig("", true))
-	cluster, err := loadLegacyConfig(content, c)
-
-	c.Check(err, IsNil)
-	c.Check(cluster, NotNil)
-	c.Check(cluster.Services.Controller.ExternalURL, Equals, arvados.URL{Scheme: "https", Host: "example.com"})
-	c.Check(cluster.SystemRootToken, Equals, "abcdefg")
-	c.Check(cluster.ManagementToken, Equals, "xyzzy")
-	c.Check(cluster.Services.Keepproxy.InternalURLs[arvados.URL{Host: ":80"}], Equals, arvados.ServiceInstance{})
-	c.Check(cluster.Collections.DefaultReplication, Equals, 0)
-	c.Check(cluster.API.KeepServiceRequestTimeout.String(), Equals, "15s")
-	c.Check(cluster.SystemLogs.LogLevel, Equals, "debug")
-
-	content = []byte(fmtConfig("", false))
-	cluster, err = loadLegacyConfig(content, c)
-	c.Check(cluster.SystemLogs.LogLevel, Equals, "info")
-
-	content = []byte(fmtConfig(`"DisableGet": true,`, true))
-	_, err = loadLegacyConfig(content, c)
-	c.Check(err, NotNil)
-
-	content = []byte(fmtConfig(`"DisablePut": true,`, true))
-	_, err = loadLegacyConfig(content, c)
-	c.Check(err, NotNil)
-
-	content = []byte(fmtConfig(`"PIDFile": "test",`, true))
-	_, err = loadLegacyConfig(content, c)
-	c.Check(err, NotNil)
-
-	content = []byte(fmtConfig(`"DisableGet": false, "DisablePut": false, "PIDFile": "",`, true))
-	_, err = loadLegacyConfig(content, c)
-	c.Check(err, IsNil)
-
-}
-
-func loadLegacyConfig(content []byte, c *C) (*arvados.Cluster, error) {
-	tmpfile, err := ioutil.TempFile("", "example")
-	if err != nil {
-		c.Error(err)
-	}
-	defer os.Remove(tmpfile.Name())
-
-	if _, err := tmpfile.Write(content); err != nil {
-		c.Error(err)
-	}
-	if err := tmpfile.Close(); err != nil {
-		c.Error(err)
-	}
-	return configure(log.New(), []string{"keepproxy", "-config", tmpfile.Name()})
-}
-
-func fmtConfig(param string, debugLog bool) string {
-	return fmt.Sprintf(`
-{
-	"Client": {
-		"Scheme": "",
-		"APIHost": "example.com",
-		"AuthToken": "abcdefg",
-		"Insecure": false
-	},
-	"Listen": ":80",
-	"DefaultReplicas": 0,
-	"Timeout": "15s",
-	"Debug": %t,
-	%s
-	"ManagementToken": "xyzzy"
-}
-`, debugLog, param)
-}

commit 729c7c95d0d9c8d0357143717d5f2bb8cdd743de
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date:   Wed Aug 14 14:35:45 2019 -0400

    14715: Fixes error handling
    
    Also removes the path assertion from the service file and fixes copy/paste typo
    
    Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>

diff --git a/lib/config/load.go b/lib/config/load.go
index c0b44c17e..84de9b60e 100644
--- a/lib/config/load.go
+++ b/lib/config/load.go
@@ -141,7 +141,7 @@ func (ldr *Loader) MungeLegacyConfigArgs(lgr logrus.FieldLogger, args []string,
 		ldr.KeepWebPath = ""
 	}
 	if legacyConfigArg != "-legacy-keepproxy-config" {
-		ldr.WebsocketPath = ""
+		ldr.KeepproxyPath = ""
 	}
 
 	return munged
diff --git a/services/keepproxy/keepproxy.go b/services/keepproxy/keepproxy.go
index 824b748bc..685007481 100644
--- a/services/keepproxy/keepproxy.go
+++ b/services/keepproxy/keepproxy.go
@@ -108,13 +108,13 @@ func main() {
 func run(logger log.FieldLogger, cluster *arvados.Cluster) error {
 	client, err := arvados.NewClientFromConfig(cluster)
 	if err != nil {
-		log.Fatal(err)
+		return err
 	}
 	client.AuthToken = cluster.SystemRootToken
 
 	arv, err := arvadosclient.New(client)
 	if err != nil {
-		log.Fatalf("Error setting up arvados client %s", err.Error())
+		return fmt.Errorf("Error setting up arvados client %v", err)
 	}
 
 	if cluster.SystemLogs.LogLevel == "debug" {
@@ -122,7 +122,7 @@ func run(logger log.FieldLogger, cluster *arvados.Cluster) error {
 	}
 	kc, err := keepclient.MakeKeepClient(arv)
 	if err != nil {
-		log.Fatalf("Error setting up keep client %s", err.Error())
+		return fmt.Errorf("Error setting up keep client %v", err)
 	}
 	keepclient.RefreshServiceDiscoveryOnSIGHUP()
 
@@ -138,13 +138,13 @@ func run(logger log.FieldLogger, cluster *arvados.Cluster) error {
 	var lErr error
 	listener, lErr = net.Listen("tcp", listen.Host)
 	if lErr != nil {
-		log.Fatalf("listen(%s): %s", listen.Host, lErr)
+		return fmt.Errorf("listen(%s): %v", listen.Host, lErr)
 	}
 
 	if _, err := daemon.SdNotify(false, "READY=1"); err != nil {
 		log.Printf("Error notifying init daemon: %v", err)
 	}
-	log.Println("Listening at", listener.Addr())
+	log.Println("listening at", listener.Addr())
 
 	// Shut down the server gracefully (by closing the listener)
 	// if SIGTERM is received.
diff --git a/services/keepproxy/keepproxy.service b/services/keepproxy/keepproxy.service
index 817aec6c4..1d0113e0e 100644
--- a/services/keepproxy/keepproxy.service
+++ b/services/keepproxy/keepproxy.service
@@ -6,7 +6,6 @@
 Description=Arvados Keep Proxy
 Documentation=https://doc.arvados.org/
 After=network.target
-AssertPathExists=/etc/arvados/config.yml
 
 # systemd==229 (ubuntu:xenial) obeys StartLimitInterval in the [Unit] section
 StartLimitInterval=0

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list