diff --git a/api/client/plugin/disable.go b/api/client/plugin/disable.go index 058c6889cd..704eb75286 100644 --- a/api/client/plugin/disable.go +++ b/api/client/plugin/disable.go @@ -37,5 +37,9 @@ func runDisable(dockerCli *client.DockerCli, name string) error { if !ok { return fmt.Errorf("invalid name: %s", named.String()) } - return dockerCli.Client().PluginDisable(context.Background(), ref.String()) + if err := dockerCli.Client().PluginDisable(context.Background(), ref.String()); err != nil { + return err + } + fmt.Fprintln(dockerCli.Out(), name) + return nil } diff --git a/api/client/plugin/enable.go b/api/client/plugin/enable.go index cc2488bcec..c31258bbb6 100644 --- a/api/client/plugin/enable.go +++ b/api/client/plugin/enable.go @@ -37,5 +37,9 @@ func runEnable(dockerCli *client.DockerCli, name string) error { if !ok { return fmt.Errorf("invalid name: %s", named.String()) } - return dockerCli.Client().PluginEnable(context.Background(), ref.String()) + if err := dockerCli.Client().PluginEnable(context.Background(), ref.String()); err != nil { + return err + } + fmt.Fprintln(dockerCli.Out(), name) + return nil } diff --git a/api/client/plugin/install.go b/api/client/plugin/install.go index 310e7229d0..a7f8d2d6e9 100644 --- a/api/client/plugin/install.go +++ b/api/client/plugin/install.go @@ -78,8 +78,11 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error { // TODO: Rename PrivilegeFunc, it has nothing to do with privileges PrivilegeFunc: registryAuthFunc, } - - return dockerCli.Client().PluginInstall(ctx, ref.String(), options) + if err := dockerCli.Client().PluginInstall(ctx, ref.String(), options); err != nil { + return err + } + fmt.Fprintln(dockerCli.Out(), opts.name) + return nil } func acceptPrivileges(dockerCli *client.DockerCli, name string) func(privileges types.PluginPrivileges) (bool, error) { diff --git a/integration-cli/docker_cli_plugins_test.go b/integration-cli/docker_cli_plugins_test.go index 252df5acef..bedeff6ecc 100644 --- a/integration-cli/docker_cli_plugins_test.go +++ b/integration-cli/docker_cli_plugins_test.go @@ -3,54 +3,63 @@ package main import ( "github.com/docker/docker/pkg/integration/checker" "github.com/go-check/check" + + "strings" +) + +var ( + pName = "tiborvass/no-remove" + pTag = "latest" + pNameWithTag = pName + ":" + pTag ) func (s *DockerSuite) TestPluginBasicOps(c *check.C) { testRequires(c, DaemonIsLinux, ExperimentalDaemon) - name := "tiborvass/no-remove" - tag := "latest" - nameWithTag := name + ":" + tag - - _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", name) + _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag) c.Assert(err, checker.IsNil) out, _, err := dockerCmdWithError("plugin", "ls") c.Assert(err, checker.IsNil) - c.Assert(out, checker.Contains, name) - c.Assert(out, checker.Contains, tag) + c.Assert(out, checker.Contains, pName) + c.Assert(out, checker.Contains, pTag) c.Assert(out, checker.Contains, "true") - out, _, err = dockerCmdWithError("plugin", "inspect", nameWithTag) + out, _, err = dockerCmdWithError("plugin", "inspect", pNameWithTag) c.Assert(err, checker.IsNil) c.Assert(out, checker.Contains, "A test plugin for Docker") - out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag) + out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag) c.Assert(out, checker.Contains, "is active") - _, _, err = dockerCmdWithError("plugin", "disable", nameWithTag) + _, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag) c.Assert(err, checker.IsNil) - out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag) + out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag) c.Assert(err, checker.IsNil) - c.Assert(out, checker.Contains, nameWithTag) + c.Assert(out, checker.Contains, pNameWithTag) } func (s *DockerSuite) TestPluginInstallDisable(c *check.C) { testRequires(c, DaemonIsLinux, ExperimentalDaemon) - name := "tiborvass/no-remove" - tag := "latest" - nameWithTag := name + ":" + tag - - _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", name) + out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName) c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Contains, pName) - out, _, err := dockerCmdWithError("plugin", "ls") + out, _, err = dockerCmdWithError("plugin", "ls") c.Assert(err, checker.IsNil) c.Assert(out, checker.Contains, "false") - out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag) + out, _, err = dockerCmdWithError("plugin", "enable", pName) c.Assert(err, checker.IsNil) - c.Assert(out, checker.Contains, nameWithTag) + c.Assert(strings.TrimSpace(out), checker.Contains, pName) + + out, _, err = dockerCmdWithError("plugin", "disable", pName) + c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Contains, pName) + + out, _, err = dockerCmdWithError("plugin", "remove", pName) + c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Contains, pName) } func (s *DockerSuite) TestPluginInstallImage(c *check.C) {