Previously, a 'plugin not found' error would be returned if a plugin to be
retrieved was found but disabled. This was misleading and incorrect. Now,
a new error plugin.ErrDisabled is returned in this case. This makes the
error message when trying to statically start plugins (from daemon.json or
dockerd command line) accurate.
Signed-off-by: David Sheets <dsheets@docker.com>
... | ... |
@@ -36,6 +36,13 @@ func (name ErrAmbiguous) Error() string { |
36 | 36 |
return fmt.Sprintf("multiple plugins found for %q", string(name)) |
37 | 37 |
} |
38 | 38 |
|
39 |
+// ErrDisabled indicates that a plugin was found but it is disabled |
|
40 |
+type ErrDisabled string |
|
41 |
+ |
|
42 |
+func (name ErrDisabled) Error() string { |
|
43 |
+ return fmt.Sprintf("plugin %s found but disabled", string(name)) |
|
44 |
+} |
|
45 |
+ |
|
39 | 46 |
// GetV2Plugin retrieves a plugin by name, id or partial ID. |
40 | 47 |
func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) { |
41 | 48 |
ps.RLock() |
... | ... |
@@ -138,7 +145,7 @@ func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug |
138 | 138 |
} |
139 | 139 |
// Plugin was found but it is disabled, so we should not fall back to legacy plugins |
140 | 140 |
// but we should error out right away |
141 |
- return nil, ErrNotFound(name) |
|
141 |
+ return nil, ErrDisabled(name) |
|
142 | 142 |
} |
143 | 143 |
if _, ok := errors.Cause(err).(ErrNotFound); !ok { |
144 | 144 |
return nil, err |