X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/adee1c1a7902de81df8cfd5064c3fa9f377faa47..f34a8d68bdd096cf1b019a9806bd1e6eba028d77:/lib/config/cmd.go diff --git a/lib/config/cmd.go b/lib/config/cmd.go index e532a7e32a..528d748c86 100644 --- a/lib/config/cmd.go +++ b/lib/config/cmd.go @@ -109,6 +109,34 @@ func (checkCommand) RunCommand(prog string, args []string, stdin io.Reader, stdo if err != nil { return 1 } + + // Check for configured vocabulary validity. + for id, cc := range withDepr.Clusters { + if cc.API.VocabularyPath == "" { + continue + } + vd, err := os.ReadFile(cc.API.VocabularyPath) + if err != nil { + if errors.Is(err, os.ErrNotExist) { + // If the vocabulary path doesn't exist, it might mean that + // the current node isn't the controller; so it's not an + // error. + continue + } + logger.Errorf("Error reading vocabulary file %q for cluster %s: %s\n", cc.API.VocabularyPath, id, err) + continue + } + mk := make([]string, 0, len(cc.Collections.ManagedProperties)) + for k := range cc.Collections.ManagedProperties { + mk = append(mk, k) + } + _, err = arvados.NewVocabulary(vd, mk) + if err != nil { + logger.Errorf("Error loading vocabulary file %q for cluster %s:\n%s\n", cc.API.VocabularyPath, id, err) + continue + } + } + cmd := exec.Command("diff", "-u", "--label", "without-deprecated-configs", "--label", "relying-on-deprecated-configs", "/dev/fd/3", "/dev/fd/4") for _, obj := range []interface{}{withoutDepr, withDepr} { y, _ := yaml.Marshal(obj) @@ -144,36 +172,6 @@ func (checkCommand) RunCommand(prog string, args []string, stdin io.Reader, stdo return 1 } } - for id, cc := range withDepr.Clusters { - if cc.API.VocabularyPath == "" { - continue - } - _, err = os.Stat(cc.API.VocabularyPath) - if err != nil { - if errors.Is(err, os.ErrNotExist) { - // If the vocabulary path doesn't exist, it might mean that - // the current node isn't the controller; so it's not an - // error. - continue - } - fmt.Fprintf(stderr, "Error checking vocabulary path %q for cluster %s: %s\n", cc.API.VocabularyPath, id, err) - return 1 - } - vd, err := os.ReadFile(cc.API.VocabularyPath) - if err != nil { - fmt.Fprintf(stderr, "Error reading vocabulary file %q for cluster %s: %s\n", cc.API.VocabularyPath, id, err) - return 1 - } - mk := make([]string, 0, len(cc.Collections.ManagedProperties)) - for k := range cc.Collections.ManagedProperties { - mk = append(mk, k) - } - _, err = arvados.NewVocabulary(vd, mk) - if err != nil { - fmt.Fprintf(stderr, "Error loading vocabulary file %q for cluster %s: %s\n", cc.API.VocabularyPath, id, err) - return 1 - } - } return 0 }