Merge pull request #30047 from duglin/distError
Add the mediaType to the error
This commit is contained in:
commit
e10f9db26d
|
@ -76,7 +76,7 @@ func runPull(dockerCli *command.DockerCli, opts pullOptions) error {
|
||||||
err = imagePullPrivileged(ctx, dockerCli, authConfig, reference.FamiliarString(distributionRef), requestPrivilege, opts.all)
|
err = imagePullPrivileged(ctx, dockerCli, authConfig, reference.FamiliarString(distributionRef), requestPrivilege, opts.all)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "target is plugin") {
|
if strings.Contains(err.Error(), "when fetching 'plugin'") {
|
||||||
return errors.New(err.Error() + " - Use `docker plugin install`")
|
return errors.New(err.Error() + " - Use `docker plugin install`")
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -144,7 +144,7 @@ func runInstall(dockerCli *command.DockerCli, opts pluginOptions) error {
|
||||||
}
|
}
|
||||||
responseBody, err := dockerCli.Client().PluginInstall(ctx, localName, options)
|
responseBody, err := dockerCli.Client().PluginInstall(ctx, localName, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "target is image") {
|
if strings.Contains(err.Error(), "(image) when fetching") {
|
||||||
return errors.New(err.Error() + " - Use `docker image pull`")
|
return errors.New(err.Error() + " - Use `docker image pull`")
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -363,7 +363,7 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named) (tagUpdat
|
||||||
if configClass == "" {
|
if configClass == "" {
|
||||||
configClass = "unknown"
|
configClass = "unknown"
|
||||||
}
|
}
|
||||||
return false, fmt.Errorf("target is %s", configClass)
|
return false, fmt.Errorf("Encountered remote %q(%s) when fetching", m.Manifest.Config.MediaType, configClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ func (s *DockerRegistrySuite) TestPluginInstallImage(c *check.C) {
|
||||||
|
|
||||||
out, _, err := dockerCmdWithError("plugin", "install", repoName)
|
out, _, err := dockerCmdWithError("plugin", "install", repoName)
|
||||||
c.Assert(err, checker.NotNil)
|
c.Assert(err, checker.NotNil)
|
||||||
c.Assert(out, checker.Contains, "target is image")
|
c.Assert(out, checker.Contains, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestPluginEnableDisableNegative(c *check.C) {
|
func (s *DockerSuite) TestPluginEnableDisableNegative(c *check.C) {
|
||||||
|
|
Loading…
Reference in New Issue