mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #5810 from guettli/better-err-msg-on-undefined-loader-behavior
Better error message on undefined loader behavior.
This commit is contained in:
@@ -34,7 +34,8 @@ type Loader struct {
|
||||
}
|
||||
|
||||
func NewLoader(
|
||||
pc *types.PluginConfig, rf *resmap.Factory, fs filesys.FileSystem) *Loader {
|
||||
pc *types.PluginConfig, rf *resmap.Factory, fs filesys.FileSystem,
|
||||
) *Loader {
|
||||
return &Loader{pc: pc, rf: rf, fs: fs}
|
||||
}
|
||||
|
||||
@@ -58,7 +59,8 @@ func (l *Loader) Config() *types.PluginConfig {
|
||||
|
||||
func (l *Loader) LoadGenerators(
|
||||
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap) (
|
||||
result []*resmap.GeneratorWithProperties, err error) {
|
||||
result []*resmap.GeneratorWithProperties, err error,
|
||||
) {
|
||||
for _, res := range rm.Resources() {
|
||||
g, err := l.LoadGenerator(ldr, v, res)
|
||||
if err != nil {
|
||||
@@ -74,7 +76,8 @@ func (l *Loader) LoadGenerators(
|
||||
}
|
||||
|
||||
func (l *Loader) LoadGenerator(
|
||||
ldr ifc.Loader, v ifc.Validator, res *resource.Resource) (resmap.Generator, error) {
|
||||
ldr ifc.Loader, v ifc.Validator, res *resource.Resource,
|
||||
) (resmap.Generator, error) {
|
||||
c, err := l.loadAndConfigurePlugin(ldr, v, res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -87,7 +90,8 @@ func (l *Loader) LoadGenerator(
|
||||
}
|
||||
|
||||
func (l *Loader) LoadTransformers(
|
||||
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap) ([]*resmap.TransformerWithProperties, error) {
|
||||
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap,
|
||||
) ([]*resmap.TransformerWithProperties, error) {
|
||||
var result []*resmap.TransformerWithProperties
|
||||
for _, res := range rm.Resources() {
|
||||
t, err := l.LoadTransformer(ldr, v, res)
|
||||
@@ -104,7 +108,8 @@ func (l *Loader) LoadTransformers(
|
||||
}
|
||||
|
||||
func (l *Loader) LoadTransformer(
|
||||
ldr ifc.Loader, v ifc.Validator, res *resource.Resource) (*resmap.TransformerWithProperties, error) {
|
||||
ldr ifc.Loader, v ifc.Validator, res *resource.Resource,
|
||||
) (*resmap.TransformerWithProperties, error) {
|
||||
c, err := l.loadAndConfigurePlugin(ldr, v, res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -179,7 +184,8 @@ func isBuiltinPlugin(res *resource.Resource) bool {
|
||||
func (l *Loader) loadAndConfigurePlugin(
|
||||
ldr ifc.Loader,
|
||||
v ifc.Validator,
|
||||
res *resource.Resource) (c resmap.Configurable, err error) {
|
||||
res *resource.Resource,
|
||||
) (c resmap.Configurable, err error) {
|
||||
if isBuiltinPlugin(res) {
|
||||
switch l.pc.BpLoadingOptions {
|
||||
case types.BploLoadFromFileSys:
|
||||
@@ -192,7 +198,7 @@ func (l *Loader) loadAndConfigurePlugin(
|
||||
c, err = l.makeBuiltinPlugin(res.GetGvk())
|
||||
default:
|
||||
err = fmt.Errorf(
|
||||
"unknown plugin loader behavior specified: %v",
|
||||
"unknown plugin loader behavior specified: %s %v", res.GetGvk().String(),
|
||||
l.pc.BpLoadingOptions)
|
||||
}
|
||||
} else {
|
||||
@@ -282,4 +288,3 @@ func (l *Loader) loadExecOrGoPlugin(resId resid.ResId) (resmap.Configurable, err
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user