MCPcopy
hub / github.com/moby/moby / Disable

Method Disable

daemon/pkg/plugin/backend_linux.go:56–81  ·  view source on GitHub ↗

Disable deactivates a plugin. This means resources (volumes, networks) cant use them.

(refOrID string, config *backend.PluginDisableConfig)

Source from the content-addressed store, hash-verified

54
55// Disable deactivates a plugin. This means resources (volumes, networks) cant use them.
56func (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.
84func (pm *Manager) Enable(refOrID string, config *backend.PluginEnableConfig) error {

Callers

nothing calls this directly

Calls 9

disableMethod · 0.95
inUseErrorTypeAlias · 0.85
GetV2PluginMethod · 0.80
GetRefCountMethod · 0.80
GetTypesMethod · 0.80
RemovePluginMethod · 0.80
LogPluginEventMethod · 0.80
NameMethod · 0.65
GetIDMethod · 0.45

Tested by

no test coverage detected