Remove plugin root from filesystem.
`docker plugin remove` didnt actually remove plugin from disk. Fix that.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit 5690730a74
)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
9ba749a497
commit
828a2473c2
2 changed files with 20 additions and 2 deletions
|
@ -4,6 +4,10 @@ import (
|
|||
"github.com/docker/docker/pkg/integration/checker"
|
||||
"github.com/go-check/check"
|
||||
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -26,7 +30,16 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
|
|||
|
||||
out, _, err = dockerCmdWithError("plugin", "inspect", pNameWithTag)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, "A test plugin for Docker")
|
||||
tmpFile, err := ioutil.TempFile("", "inspect.json")
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer tmpFile.Close()
|
||||
|
||||
if _, err := tmpFile.Write([]byte(out)); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
// FIXME: When `docker plugin inspect` takes a format as input, jq can be replaced.
|
||||
id, err := exec.Command("jq", ".Id", "--raw-output", tmpFile.Name()).CombinedOutput()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
||||
c.Assert(out, checker.Contains, "is active")
|
||||
|
@ -37,6 +50,11 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
|
|||
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, pNameWithTag)
|
||||
|
||||
_, err = os.Stat(filepath.Join(dockerBasePath, "plugins", string(id)))
|
||||
if !os.IsNotExist(err) {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPluginInstallDisable(c *check.C) {
|
||||
|
|
|
@ -372,7 +372,7 @@ func (pm *Manager) remove(p *plugin) error {
|
|||
delete(pm.plugins, p.PluginObj.ID)
|
||||
delete(pm.nameToID, p.Name())
|
||||
pm.save()
|
||||
return nil
|
||||
return os.RemoveAll(filepath.Join(pm.libRoot, p.PluginObj.ID))
|
||||
}
|
||||
|
||||
func (pm *Manager) set(p *plugin, args []string) error {
|
||||
|
|
Loading…
Reference in a new issue