Merge pull request #33640 from dsheets/pluginv2-static-start-but-disabled-error
plugin/store.Get: return a specific error if plugin is disabled
This commit is contained in:
commit
397a57d3a5
1 changed files with 9 additions and 2 deletions
|
@ -29,13 +29,20 @@ type ErrNotFound string
|
|||
|
||||
func (name ErrNotFound) Error() string { return fmt.Sprintf("plugin %q not found", string(name)) }
|
||||
|
||||
// ErrAmbiguous indicates that a plugin was not found locally.
|
||||
// ErrAmbiguous indicates that more than one plugin was found
|
||||
type ErrAmbiguous string
|
||||
|
||||
func (name ErrAmbiguous) Error() string {
|
||||
return fmt.Sprintf("multiple plugins found for %q", string(name))
|
||||
}
|
||||
|
||||
// ErrDisabled indicates that a plugin was found but it is disabled
|
||||
type ErrDisabled string
|
||||
|
||||
func (name ErrDisabled) Error() string {
|
||||
return fmt.Sprintf("plugin %s found but disabled", string(name))
|
||||
}
|
||||
|
||||
// GetV2Plugin retrieves a plugin by name, id or partial ID.
|
||||
func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) {
|
||||
ps.RLock()
|
||||
|
@ -138,7 +145,7 @@ func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug
|
|||
}
|
||||
// Plugin was found but it is disabled, so we should not fall back to legacy plugins
|
||||
// but we should error out right away
|
||||
return nil, ErrNotFound(name)
|
||||
return nil, ErrDisabled(name)
|
||||
}
|
||||
if _, ok := errors.Cause(err).(ErrNotFound); !ok {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue