[ARVADOS] updated: 1.3.0-1336-g26c517777

Git user git at public.curoverse.com
Tue Jul 23 20:33:19 UTC 2019


Summary of changes:
 build/run-tests.sh                                 | 19 +++++------------
 lib/config/deprecated.go                           | 12 +++++------
 lib/config/load.go                                 | 24 ++++------------------
 .../crunch-dispatch-slurm/crunch-dispatch-slurm.go |  1 -
 services/ws/main.go                                |  1 -
 services/ws/server_test.go                         |  1 -
 6 files changed, 15 insertions(+), 43 deletions(-)

       via  26c517777afbdb9668ab24aa61bfc44ecd7f26b9 (commit)
      from  b2df3cba90166bc67dd93600ac1a44ac6f9e81bd (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 26c517777afbdb9668ab24aa61bfc44ecd7f26b9
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Tue Jul 23 16:32:28 2019 -0400

    14717: Remove LegacyComponentConfig behavior
    
    run-tests.sh now requires a minimal config.yml with database information.
    
    Remove database.yml from run-tests.sh
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/build/run-tests.sh b/build/run-tests.sh
index 14f889ad6..7b915a533 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -625,10 +625,11 @@ initialize() {
     setup_ruby_environment
 
     if [[ -s "$CONFIGSRC/config.yml" ]] ; then
+	echo "Getting database configuration from $CONFIGSRC/config.yml"
 	cp "$CONFIGSRC/config.yml" "$temp/test-config.yml"
-	export ARVADOS_CONFIG="$temp/test-config.yml"
     else
 	if [[ -s /etc/arvados/config.yml ]] ; then
+	    echo "Getting database configuration from /etc/arvados/config.yml"
 	    python > "$temp/test-config.yml" <<EOF
 import yaml
 import json
@@ -636,13 +637,11 @@ v = list(yaml.safe_load(open('/etc/arvados/config.yml'))['Clusters'].values())[0
 v['Connection']['dbname'] = 'arvados_test'
 print(json.dumps({"Clusters": { "zzzzz": {'PostgreSQL': v}}}))
 EOF
-	    export ARVADOS_CONFIG="$temp/test-config.yml"
 	else
-	    if [[ ! -f "$WORKSPACE/services/api/config/database.yml" ]]; then
-		fatal "Please provide a database.yml file for the test suite"
-	    fi
+	    fatal "Please provide a config.yml file for the test suite in CONFIGSRC or /etc/arvados"
 	fi
     fi
+    export ARVADOS_CONFIG="$temp/test-config.yml"
 
     echo "PATH is $PATH"
 }
@@ -943,19 +942,11 @@ install_services/api() {
     rm -f config/environments/test.rb
     cp config/environments/test.rb.example config/environments/test.rb
 
-    if [ -n "$CONFIGSRC" ]
-    then
-        for f in database.yml
-        do
-            cp "$CONFIGSRC/$f" config/ || fatal "$f"
-        done
-    fi
-
     # Clear out any lingering postgresql connections to the test
     # database, so that we can drop it. This assumes the current user
     # is a postgresql superuser.
     cd "$WORKSPACE/services/api" \
-        && test_database=$(python -c "import yaml; print yaml.safe_load(file('config/database.yml'))['test']['database']") \
+        && test_database=$(python -c "import yaml; print yaml.safe_load(file('$ARVADOS_CONFIG'))['Clusters']['zzzzz']['PostgreSQL']['Connection']['dbname']") \
         && psql "$test_database" -c "SELECT pg_terminate_backend (pg_stat_activity.pid::int) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$test_database';" 2>/dev/null
 
     mkdir -p "$WORKSPACE/services/api/tmp/pids"
diff --git a/lib/config/deprecated.go b/lib/config/deprecated.go
index 845e5113f..3e1ec7278 100644
--- a/lib/config/deprecated.go
+++ b/lib/config/deprecated.go
@@ -127,10 +127,10 @@ func (ldr *Loader) loadOldConfigHelper(component, path string, target interface{
 }
 
 // update config using values from an old-style keepstore config file.
-func (ldr *Loader) loadOldKeepstoreConfig(cfg *arvados.Config, required bool) error {
+func (ldr *Loader) loadOldKeepstoreConfig(cfg *arvados.Config) error {
 	var oc oldKeepstoreConfig
 	err := ldr.loadOldConfigHelper("keepstore", ldr.KeepstorePath, &oc)
-	if os.IsNotExist(err) && !required {
+	if os.IsNotExist(err) && (ldr.KeepstorePath == defaultKeepstoreConfigPath) {
 		return nil
 	} else if err != nil {
 		return err
@@ -197,10 +197,10 @@ func loadOldClientConfig(cluster *arvados.Cluster, client *arvados.Client) {
 }
 
 // update config using values from an crunch-dispatch-slurm config file.
-func (ldr *Loader) loadOldCrunchDispatchSlurmConfig(cfg *arvados.Config, required bool) error {
+func (ldr *Loader) loadOldCrunchDispatchSlurmConfig(cfg *arvados.Config) error {
 	var oc oldCrunchDispatchSlurmConfig
 	err := ldr.loadOldConfigHelper("crunch-dispatch-slurm", ldr.CrunchDispatchSlurmPath, &oc)
-	if os.IsNotExist(err) && !required {
+	if os.IsNotExist(err) && (ldr.CrunchDispatchSlurmPath == defaultCrunchDispatchSlurmConfigPath) {
 		return nil
 	} else if err != nil {
 		return err
@@ -262,10 +262,10 @@ type oldWsConfig struct {
 const defaultWebsocketConfigPath = "/etc/arvados/ws/ws.yml"
 
 // update config using values from an crunch-dispatch-slurm config file.
-func (ldr *Loader) loadOldWebsocketConfig(cfg *arvados.Config, required bool) error {
+func (ldr *Loader) loadOldWebsocketConfig(cfg *arvados.Config) error {
 	var oc oldWsConfig
 	err := ldr.loadOldConfigHelper("arvados-ws", ldr.WebsocketPath, &oc)
-	if os.IsNotExist(err) && !required {
+	if os.IsNotExist(err) && ldr.WebsocketPath == defaultWebsocketConfigPath {
 		return nil
 	} else if err != nil {
 		return err
diff --git a/lib/config/load.go b/lib/config/load.go
index f9ee6989d..2dacd5c26 100644
--- a/lib/config/load.go
+++ b/lib/config/load.go
@@ -33,12 +33,6 @@ type Loader struct {
 	CrunchDispatchSlurmPath string
 	WebsocketPath           string
 
-	// Legacy config file for the current component (will be the
-	// same as one of the above files).  If set, not being able to
-	// load the 'main' config.yml will not be a fatal error, but
-	// the the legacy file will be required instead.
-	LegacyComponentConfig string
-
 	configdata []byte
 }
 
@@ -144,15 +138,10 @@ func (ldr *Loader) Load() (*arvados.Config, error) {
 	if ldr.configdata == nil {
 		buf, err := ldr.loadBytes(ldr.Path)
 		if err != nil {
-			if ldr.LegacyComponentConfig != "" && os.IsNotExist(err) && !ldr.SkipDeprecated {
-				buf = []byte(`Clusters: {zzzzz: {}}`)
-			} else {
-				return nil, err
-			}
+			return nil, err
 		}
 		ldr.configdata = buf
 	}
-	noConfigLoaded := bytes.Compare(ldr.configdata, []byte(`Clusters: {zzzzz: {}}`)) == 0
 
 	// Load the config into a dummy map to get the cluster ID
 	// keys, discarding the values; then set up defaults for each
@@ -223,14 +212,9 @@ func (ldr *Loader) Load() (*arvados.Config, error) {
 		// * no primary config was loaded, and this is the
 		// legacy config file for the current component
 		for _, err := range []error{
-			ldr.loadOldKeepstoreConfig(&cfg, (ldr.KeepstorePath != defaultKeepstoreConfigPath) ||
-				(noConfigLoaded && ldr.LegacyComponentConfig == ldr.KeepstorePath)),
-
-			ldr.loadOldCrunchDispatchSlurmConfig(&cfg, (ldr.CrunchDispatchSlurmPath != defaultCrunchDispatchSlurmConfigPath) ||
-				(noConfigLoaded && ldr.LegacyComponentConfig == ldr.CrunchDispatchSlurmPath)),
-
-			ldr.loadOldWebsocketConfig(&cfg, (ldr.WebsocketPath != defaultWebsocketConfigPath) ||
-				(noConfigLoaded && ldr.LegacyComponentConfig == ldr.WebsocketPath)),
+			ldr.loadOldKeepstoreConfig(&cfg),
+			ldr.loadOldCrunchDispatchSlurmConfig(&cfg),
+			ldr.loadOldWebsocketConfig(&cfg),
 		} {
 			if err != nil {
 				return nil, err
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index 75e6146f5..1a7ad6fac 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -109,7 +109,6 @@ func (disp *Dispatcher) configure(prog string, args []string) error {
 
 	disp.logger.Printf("crunch-dispatch-slurm %s started", version)
 
-	loader.LegacyComponentConfig = loader.CrunchDispatchSlurmPath
 	cfg, err := loader.Load()
 	if err != nil {
 		return err
diff --git a/services/ws/main.go b/services/ws/main.go
index 2ea1a987d..0556c77d6 100644
--- a/services/ws/main.go
+++ b/services/ws/main.go
@@ -36,7 +36,6 @@ func configure(log logrus.FieldLogger, args []string) *arvados.Cluster {
 		return nil
 	}
 
-	loader.LegacyComponentConfig = loader.WebsocketPath
 	cfg, err := loader.Load()
 	if err != nil {
 		log.Fatal(err)
diff --git a/services/ws/server_test.go b/services/ws/server_test.go
index 1d6231fe8..8b43cef37 100644
--- a/services/ws/server_test.go
+++ b/services/ws/server_test.go
@@ -36,7 +36,6 @@ func (s *serverSuite) SetUpTest(c *check.C) {
 
 func (*serverSuite) testConfig() (*arvados.Cluster, error) {
 	ldr := config.NewLoader(nil, nil)
-	ldr.LegacyComponentConfig = "ws-test"
 	cfg, err := ldr.Load()
 	if err != nil {
 		return nil, err

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list