18491: Removes an unnecessary check that made the test fail on module upgrade.
[arvados.git] / lib / controller / localdb / conn.go
index f515673154b60da2d1522371de0f98c6fb8c0e7d..323e660c6f1e75d79721466e513dc8c611a52833 100644 (file)
@@ -18,6 +18,7 @@ import (
        "git.arvados.org/arvados.git/sdk/go/arvados"
        "git.arvados.org/arvados.git/sdk/go/ctxlog"
        "git.arvados.org/arvados.git/sdk/go/httpserver"
+       "github.com/sirupsen/logrus"
 )
 
 type railsProxy = rpc.Conn
@@ -70,7 +71,7 @@ func (conn *Conn) checkProperties(ctx context.Context, properties interface{}) e
        return nil
 }
 
-func (conn *Conn) maybeRefreshVocabularyCache() error {
+func (conn *Conn) maybeRefreshVocabularyCache(logger logrus.FieldLogger) error {
        if conn.lastVocabularyRefreshCheck.Add(time.Second).After(time.Now()) {
                // Throttle the access to disk to at most once per second.
                return nil
@@ -90,6 +91,7 @@ func (conn *Conn) maybeRefreshVocabularyCache() error {
                }
                conn.vocabularyFileModTime = fi.ModTime()
                conn.lastVocabularyError = nil
+               logger.Info("vocabulary file reloaded successfully")
        }
        return nil
 }
@@ -107,18 +109,15 @@ func (conn *Conn) loadVocabularyFile() error {
        if err != nil {
                return fmt.Errorf("while loading vocabulary file %q: %s", conn.cluster.API.VocabularyPath, err)
        }
-       err = voc.Validate()
-       if err != nil {
-               return fmt.Errorf("while validating vocabulary file %q: %s", conn.cluster.API.VocabularyPath, err)
-       }
        conn.vocabularyCache = voc
        return nil
 }
 
 // LastVocabularyError returns the last error encountered while loading the
 // vocabulary file.
+// Implements health.Func
 func (conn *Conn) LastVocabularyError() error {
-       conn.maybeRefreshVocabularyCache()
+       conn.maybeRefreshVocabularyCache(ctxlog.FromContext(context.Background()))
        return conn.lastVocabularyError
 }
 
@@ -138,11 +137,9 @@ func (conn *Conn) VocabularyGet(ctx context.Context) (arvados.Vocabulary, error)
                        return arvados.Vocabulary{}, err
                }
        }
-       err := conn.maybeRefreshVocabularyCache()
+       err := conn.maybeRefreshVocabularyCache(logger)
        if err != nil {
                logger.WithError(err).Error("error reloading vocabulary file - ignoring")
-       } else {
-               logger.Info("vocabulary file reloaded successfully")
        }
        return *conn.vocabularyCache, nil
 }