plugin/store.Get: return a specific error if plugin is disabled#33640
plugin/store.Get: return a specific error if plugin is disabled#33640vdemeester merged 2 commits intomoby:masterfrom
Conversation
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>
Signed-off-by: David Sheets <dsheets@docker.com>
269fad7 to
2b79dfc
Compare
|
The way the plugin errors are getting used is incorrect. For ex: libnetwork references the This is an existing issue and not specific to this PR. We can either address it here or do it as a separate PR. |
|
Ugh, I'd prefer not to expand the surface area of plugingetter. |
|
plugingetter doesn't have to change. We can move the error types defined in plugin/store.go to pkg/plugins/discovery.go. Since pkg/plugins is included by the plugin package and the clients (like libnetwork) as well the same type will get used. |
|
I don't want to block this PR though. This LGTM. Lets fix the incorrect error type reference in a separate PR. |
|
ping @sanimej were you planning on working on those changes, or do we have to open an issue for tracking that? |
- What I did
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.ErrDisabledis returned in this case. This makes the error message when trying to statically start plugins (fromdaemon.jsonordockerdcommand line) accurate.- How I did it
I created a new type alias
ErrDisabledto mirrorErrNotFoundandErrAmbiguous. It satisfies theerrorinterface.- How to verify it
then restart
dockerdand add--authorization-plugin=riyaz/authz-no-volume-pluginto the command line.docker.logwill then have the "found but disabled" message instead of the "not found" message.I tried to write a test for this but I couldn't figure out how to match on the daemon log error.
- Description for the changelog
Probably does not deserve a changelog entry but if you add one:
"Improved error message when trying to start daemon with installed but disabled plugin"
- A picture of a cute animal (not mandatory but encouraged)
By Trebol-a - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=4607913
Suncus etruscus, the Etruscan shrew, is the smallest known mammal by mass and consumes 1.5-2x its own body weight in food per day. It has a very high heart rate of up to 1511 beats/minute.