Skip to content

Commit 01f8949

Browse files
authored
Merge pull request #6472 from thaJeztah/28.x_backport_remove_special_handlings
[28.x backport] remove special handling for plugin errors and Windows warning on Build
2 parents b9e3346 + 3bacc99 commit 01f8949

File tree

5 files changed

+6
-36
lines changed

5 files changed

+6
-36
lines changed

cli/command/image/build.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"io"
1111
"os"
1212
"path/filepath"
13-
"runtime"
1413
"strings"
1514

1615
"github.com/distribution/reference"
@@ -385,16 +384,6 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
385384
return err
386385
}
387386

388-
// Windows: show error message about modified file permissions if the
389-
// daemon isn't running Windows.
390-
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
391-
_, _ = fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+
392-
"image from Windows against a non-Windows Docker host. All files and "+
393-
"directories added to build context will have '-rwxr-xr-x' permissions. "+
394-
"It is recommended to double check and reset permissions for sensitive "+
395-
"files and directories.")
396-
}
397-
398387
// Everything worked so if -q was provided the output from the daemon
399388
// should be just the image ID and we'll print that to stdout.
400389
if options.quiet {

cli/command/image/pull.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package image
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
6-
"strings"
77

88
"github.com/distribution/reference"
99
"github.com/docker/cli/cli"
1010
"github.com/docker/cli/cli/command"
1111
"github.com/docker/cli/cli/command/completion"
1212
"github.com/docker/cli/cli/trust"
13-
"github.com/pkg/errors"
1413
"github.com/spf13/cobra"
1514
)
1615

@@ -87,15 +86,13 @@ func runPull(ctx context.Context, dockerCLI command.Cli, opts pullOptions) error
8786
// Check if reference has a digest
8887
_, isCanonical := distributionRef.(reference.Canonical)
8988
if !opts.untrusted && !isCanonical {
90-
err = trustedPull(ctx, dockerCLI, imgRefAndAuth, opts)
89+
if err := trustedPull(ctx, dockerCLI, imgRefAndAuth, opts); err != nil {
90+
return err
91+
}
9192
} else {
92-
err = imagePullPrivileged(ctx, dockerCLI, imgRefAndAuth, opts)
93-
}
94-
if err != nil {
95-
if strings.Contains(err.Error(), "when fetching 'plugin'") {
96-
return errors.New(err.Error() + " - Use `docker plugin install`")
93+
if err := imagePullPrivileged(ctx, dockerCLI, imgRefAndAuth, opts); err != nil {
94+
return err
9795
}
98-
return err
9996
}
10097
_, _ = fmt.Fprintln(dockerCLI.Out(), imgRefAndAuth.Reference().String())
10198
return nil

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)