mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
plugins: do not try to contact disabled plugin
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 84e58e2f89
)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
parent
40a56f29e2
commit
fb3c3d7eea
1 changed files with 8 additions and 3 deletions
|
@ -126,7 +126,7 @@ func (ps *Store) updatePluginDB() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns a plugin matching the given name and capability.
|
// Get returns an enabled plugin matching the given name and capability.
|
||||||
func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlugin, error) {
|
func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlugin, error) {
|
||||||
var (
|
var (
|
||||||
p *v2.Plugin
|
p *v2.Plugin
|
||||||
|
@ -151,8 +151,13 @@ func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug
|
||||||
p.Lock()
|
p.Lock()
|
||||||
p.RefCount += mode
|
p.RefCount += mode
|
||||||
p.Unlock()
|
p.Unlock()
|
||||||
|
if p.IsEnabled() {
|
||||||
return p.FilterByCap(capability)
|
return p.FilterByCap(capability)
|
||||||
}
|
}
|
||||||
|
// 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(fullName)
|
||||||
|
}
|
||||||
if _, ok := err.(ErrNotFound); !ok {
|
if _, ok := err.(ErrNotFound); !ok {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -170,7 +175,7 @@ func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAllByCap returns a list of plugins matching the given capability.
|
// GetAllByCap returns a list of enabled plugins matching the given capability.
|
||||||
func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
|
func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
|
||||||
result := make([]plugingetter.CompatPlugin, 0, 1)
|
result := make([]plugingetter.CompatPlugin, 0, 1)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue