mirror of https://github.com/docker/docs.git
Fix removing plugins
Signed-off-by: Brian Goff <cpuguy83@gmail.com> (cherry picked from commit 5e156fd3d4b21267caca093dd0df7ed6bce85535)
This commit is contained in:
parent
efc10a92ef
commit
be82ff5c7f
|
@ -76,10 +76,6 @@ func (pm *Manager) Pull(name string, metaHeader http.Header, authConfig *types.A
|
||||||
}
|
}
|
||||||
|
|
||||||
p := pm.newPlugin(ref, pluginID)
|
p := pm.newPlugin(ref, pluginID)
|
||||||
if ref, ok := ref.(reference.NamedTagged); ok {
|
|
||||||
p.p.Tag = ref.Tag()
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := pm.initPlugin(p); err != nil {
|
if err := pm.initPlugin(p); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,12 @@ func (p *plugin) Client() *plugins.Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *plugin) Name() string {
|
func (p *plugin) Name() string {
|
||||||
return p.p.Name
|
name := p.p.Name
|
||||||
|
if len(p.p.Tag) > 0 {
|
||||||
|
// TODO: this feels hacky, maybe we should be storing the distribution reference rather than splitting these
|
||||||
|
name += ":" + p.p.Tag
|
||||||
|
}
|
||||||
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pm *Manager) newPlugin(ref reference.Named, id string) *plugin {
|
func (pm *Manager) newPlugin(ref reference.Named, id string) *plugin {
|
||||||
|
@ -300,12 +305,13 @@ func (pm *Manager) initPlugin(p *plugin) error {
|
||||||
|
|
||||||
func (pm *Manager) remove(p *plugin) error {
|
func (pm *Manager) remove(p *plugin) error {
|
||||||
if p.p.Active {
|
if p.p.Active {
|
||||||
return fmt.Errorf("plugin %s is active", p.p.Name)
|
return fmt.Errorf("plugin %s is active", p.Name())
|
||||||
}
|
}
|
||||||
pm.Lock() // fixme: lock single record
|
pm.Lock() // fixme: lock single record
|
||||||
defer pm.Unlock()
|
defer pm.Unlock()
|
||||||
os.RemoveAll(p.stateSourcePath)
|
os.RemoveAll(p.stateSourcePath)
|
||||||
delete(pm.plugins, p.p.Name)
|
delete(pm.plugins, p.p.ID)
|
||||||
|
delete(pm.nameToID, p.Name())
|
||||||
pm.save()
|
pm.save()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue