Merge pull request #18810 from runcom/pkg-authz-fixes
pkg: authorization: do not register the same plugin
This commit is contained in:
commit
4fef057438
3 changed files with 9 additions and 5 deletions
|
@ -17,9 +17,14 @@ type Plugin interface {
|
|||
|
||||
// NewPlugins constructs and initialize the authorization plugins based on plugin names
|
||||
func NewPlugins(names []string) []Plugin {
|
||||
plugins := make([]Plugin, len(names))
|
||||
for i, name := range names {
|
||||
plugins[i] = newAuthorizationPlugin(name)
|
||||
plugins := []Plugin{}
|
||||
pluginsMap := make(map[string]struct{})
|
||||
for _, name := range names {
|
||||
if _, ok := pluginsMap[name]; ok {
|
||||
continue
|
||||
}
|
||||
pluginsMap[name] = struct{}{}
|
||||
plugins = append(plugins, newAuthorizationPlugin(name))
|
||||
}
|
||||
return plugins
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
var (
|
||||
// ErrNotFound plugin not found
|
||||
ErrNotFound = errors.New("Plugin not found")
|
||||
ErrNotFound = errors.New("plugin not found")
|
||||
socketsPath = "/run/docker/plugins"
|
||||
specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
|
||||
)
|
||||
|
|
|
@ -96,7 +96,6 @@ func (p *Plugin) activateWithLock() error {
|
|||
return err
|
||||
}
|
||||
|
||||
logrus.Debugf("%s's manifest: %v", p.Name, m)
|
||||
p.Manifest = m
|
||||
|
||||
for _, iface := range m.Implements {
|
||||
|
|
Loading…
Reference in a new issue