|
@@ -29,13 +29,20 @@ type ErrNotFound string
|
|
|
|
|
|
func (name ErrNotFound) Error() string { return fmt.Sprintf("plugin %q not found", string(name)) }
|
|
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
|
|
type ErrAmbiguous string
|
|
|
|
|
|
func (name ErrAmbiguous) Error() string {
|
|
func (name ErrAmbiguous) Error() string {
|
|
return fmt.Sprintf("multiple plugins found for %q", string(name))
|
|
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.
|
|
// GetV2Plugin retrieves a plugin by name, id or partial ID.
|
|
func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) {
|
|
func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) {
|
|
ps.RLock()
|
|
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
|
|
// Plugin was found but it is disabled, so we should not fall back to legacy plugins
|
|
// but we should error out right away
|
|
// but we should error out right away
|
|
- return nil, ErrNotFound(name)
|
|
|
|
|
|
+ return nil, ErrDisabled(name)
|
|
}
|
|
}
|
|
if _, ok := errors.Cause(err).(ErrNotFound); !ok {
|
|
if _, ok := errors.Cause(err).(ErrNotFound); !ok {
|
|
return nil, err
|
|
return nil, err
|