- 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
- }
- }