mirror of https://github.com/docker/docs.git
Detect non-plugin content during install and error out.
Signed-off-by: Anusha Ragunathan <anusha@docker.com> (cherry picked from commit d32df6d934875052232bbbc49fa473bd283af6e4) Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
843b4a93fe
commit
61dc82f423
|
@ -52,3 +52,10 @@ func (s *DockerSuite) TestPluginInstallDisable(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
c.Assert(out, checker.Contains, nameWithTag)
|
c.Assert(out, checker.Contains, nameWithTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *DockerSuite) TestPluginInstallImage(c *check.C) {
|
||||||
|
testRequires(c, DaemonIsLinux, ExperimentalDaemon)
|
||||||
|
out, _, err := dockerCmdWithError("plugin", "install", "redis")
|
||||||
|
c.Assert(err, checker.NotNil)
|
||||||
|
c.Assert(out, checker.Contains, "content is not a plugin")
|
||||||
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ func Pull(name string, rs registry.Service, metaheader http.Header, authConfig *
|
||||||
}
|
}
|
||||||
if !confirmedV2 {
|
if !confirmedV2 {
|
||||||
logrus.Debugf("pull.go: !confirmedV2")
|
logrus.Debugf("pull.go: !confirmedV2")
|
||||||
return nil, ErrUnSupportedRegistry
|
return nil, ErrUnsupportedRegistry
|
||||||
}
|
}
|
||||||
logrus.Debugf("Trying to pull %s from %s %s", repoInfo.Name(), endpoint.URL, endpoint.Version)
|
logrus.Debugf("Trying to pull %s from %s %s", repoInfo.Name(), endpoint.URL, endpoint.Version)
|
||||||
break
|
break
|
||||||
|
@ -143,6 +143,9 @@ func Pull(name string, rs registry.Service, metaheader http.Header, authConfig *
|
||||||
logrus.Debugf("pull.go: error in json.Unmarshal(): %v", err)
|
logrus.Debugf("pull.go: error in json.Unmarshal(): %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if m.Config.MediaType != MediaTypeConfig {
|
||||||
|
return nil, ErrUnsupportedMediaType
|
||||||
|
}
|
||||||
|
|
||||||
pd := &pullData{
|
pd := &pullData{
|
||||||
repository: repository,
|
repository: repository,
|
||||||
|
|
|
@ -51,7 +51,7 @@ func Push(name string, rs registry.Service, metaHeader http.Header, authConfig *
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if !confirmedV2 {
|
if !confirmedV2 {
|
||||||
return "", ErrUnSupportedRegistry
|
return "", ErrUnsupportedRegistry
|
||||||
}
|
}
|
||||||
logrus.Debugf("Trying to push %s to %s %s", repoInfo.Name(), endpoint.URL, endpoint.Version)
|
logrus.Debugf("Trying to push %s to %s %s", repoInfo.Name(), endpoint.URL, endpoint.Version)
|
||||||
// This means that we found an endpoint. and we are ready to push
|
// This means that we found an endpoint. and we are ready to push
|
||||||
|
|
|
@ -4,8 +4,11 @@ package distribution
|
||||||
|
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
// ErrUnSupportedRegistry indicates that the registry does not support v2 protocol
|
// ErrUnsupportedRegistry indicates that the registry does not support v2 protocol
|
||||||
var ErrUnSupportedRegistry = errors.New("Only V2 repositories are supported for plugin distribution")
|
var ErrUnsupportedRegistry = errors.New("only V2 repositories are supported for plugin distribution")
|
||||||
|
|
||||||
|
// ErrUnsupportedMediaType indicates we are pulling content that's not a plugin
|
||||||
|
var ErrUnsupportedMediaType = errors.New("content is not a plugin")
|
||||||
|
|
||||||
// Plugin related media types
|
// Plugin related media types
|
||||||
const (
|
const (
|
||||||
|
|
Loading…
Reference in New Issue