Skip to content

Commit f77defa

Browse files
committed
cli/command/plugin: remove special error handling on install, upgrade
Similar to 323fbc4 - this code was added in [moby@c127d96], but used string-matching to detect cases where a user tried to install an image as plugin. However, this handling no longer matched any error-strings, so no longer worked: docker plugin install busybox Error response from daemon: did not find plugin config for specified reference docker.io/library/busybox:latest [moby@c127d96]: moby/moby@c127d96 Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit fb3f2da) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 4a677b8 commit f77defa

File tree

3 files changed

+0
-16
lines changed

3 files changed

+0
-16
lines changed

cli/command/plugin/install.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package plugin
33
import (
44
"context"
55
"fmt"
6-
"strings"
76

87
"github.com/distribution/reference"
98
"github.com/docker/cli/cli"
@@ -120,9 +119,6 @@ func runInstall(ctx context.Context, dockerCLI command.Cli, opts pluginOptions)
120119
}
121120
responseBody, err := dockerCLI.Client().PluginInstall(ctx, localName, options)
122121
if err != nil {
123-
if strings.Contains(err.Error(), "(image) when fetching") {
124-
return errors.New(err.Error() + " - Use \"docker image pull\"")
125-
}
126122
return err
127123
}
128124
defer func() {

cli/command/plugin/install_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ func TestInstallErrors(t *testing.T) {
4343
return nil, errors.New("error installing plugin")
4444
},
4545
},
46-
{
47-
description: "installation error due to missing image",
48-
args: []string{"foo"},
49-
expectedError: "docker image pull",
50-
installFunc: func(name string, options types.PluginInstallOptions) (io.ReadCloser, error) {
51-
return nil, errors.New("(image) when fetching")
52-
},
53-
},
5446
}
5547

5648
for _, tc := range testCases {

cli/command/plugin/upgrade.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package plugin
33
import (
44
"context"
55
"fmt"
6-
"strings"
76

87
"github.com/distribution/reference"
98
"github.com/docker/cli/cli"
@@ -80,9 +79,6 @@ func runUpgrade(ctx context.Context, dockerCLI command.Cli, opts pluginOptions)
8079

8180
responseBody, err := dockerCLI.Client().PluginUpgrade(ctx, opts.localName, options)
8281
if err != nil {
83-
if strings.Contains(err.Error(), "target is image") {
84-
return errors.New(err.Error() + " - Use `docker image pull`")
85-
}
8682
return err
8783
}
8884
defer func() {

0 commit comments

Comments
 (0)