diff --git a/pkg/clusterfile/decoder.go b/pkg/clusterfile/decoder.go index 4c6b3e545cb..7979d100662 100644 --- a/pkg/clusterfile/decoder.go +++ b/pkg/clusterfile/decoder.go @@ -85,6 +85,15 @@ func decodeClusterFile(reader io.Reader, clusterfile *ClusterFile) error { if err := yaml.Unmarshal(ext.Raw, &cfg); err != nil { return fmt.Errorf("failed to decode %s[%s]: %v", metaType.Kind, metaType.APIVersion, err) } + + if cfg.Spec.Path == "" { + return fmt.Errorf("failed to decode config %s, config path is empty", cfg.Name) + } + + if cfg.Spec.Data == "" { + return fmt.Errorf("failed to decode config %s, config data is empty", cfg.Name) + } + clusterfile.configs = append(clusterfile.configs, cfg) case constants.PluginKind: var plu v1.Plugin diff --git a/pkg/config/config.go b/pkg/config/config.go index c81edca1dca..ee4e51cd793 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -59,7 +59,7 @@ func (c *Dumper) Dump(configs []v1.Config) error { } if err := c.WriteFiles(configs); err != nil { - return fmt.Errorf("failed to write config files %v", err) + return fmt.Errorf("failed to dump config files %v", err) } return nil }