Disable deactivates a plugin. This means resources (volumes, networks) cant use them.
(refOrID string, config *backend.PluginDisableConfig)
| 54 | |
| 55 | // Disable deactivates a plugin. This means resources (volumes, networks) cant use them. |
| 56 | func (pm *Manager) Disable(refOrID string, config *backend.PluginDisableConfig) error { |
| 57 | p, err := pm.config.Store.GetV2Plugin(refOrID) |
| 58 | if err != nil { |
| 59 | return err |
| 60 | } |
| 61 | pm.mu.RLock() |
| 62 | c := pm.cMap[p] |
| 63 | pm.mu.RUnlock() |
| 64 | |
| 65 | if !config.ForceDisable && p.GetRefCount() > 0 { |
| 66 | return errors.WithStack(inUseError(p.Name())) |
| 67 | } |
| 68 | |
| 69 | for _, typ := range p.GetTypes() { |
| 70 | if typ.Capability == authorization.AuthZApiImplements { |
| 71 | pm.config.AuthzMiddleware.RemovePlugin(p.Name()) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | if err := pm.disable(p, c); err != nil { |
| 76 | return err |
| 77 | } |
| 78 | pm.publisher.Publish(EventDisable{Plugin: p.PluginObj}) |
| 79 | pm.config.LogPluginEvent(p.GetID(), refOrID, events.ActionDisable) |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | // Enable activates a plugin, which implies that they are ready to be used by containers. |
| 84 | func (pm *Manager) Enable(refOrID string, config *backend.PluginEnableConfig) error { |
nothing calls this directly
no test coverage detected