Signed-off-by: Anusha Ragunathan <anusha@docker.com>
| ... | ... |
@@ -52,3 +52,10 @@ func (s *DockerSuite) TestPluginInstallDisable(c *check.C) {
|
| 52 | 52 |
c.Assert(err, checker.IsNil) |
| 53 | 53 |
c.Assert(out, checker.Contains, nameWithTag) |
| 54 | 54 |
} |
| 55 |
+ |
|
| 56 |
+func (s *DockerSuite) TestPluginInstallImage(c *check.C) {
|
|
| 57 |
+ testRequires(c, DaemonIsLinux, ExperimentalDaemon) |
|
| 58 |
+ out, _, err := dockerCmdWithError("plugin", "install", "redis")
|
|
| 59 |
+ c.Assert(err, checker.NotNil) |
|
| 60 |
+ c.Assert(out, checker.Contains, "content is not a plugin") |
|
| 61 |
+} |
| ... | ... |
@@ -104,7 +104,7 @@ func Pull(name string, rs registry.Service, metaheader http.Header, authConfig * |
| 104 | 104 |
} |
| 105 | 105 |
if !confirmedV2 {
|
| 106 | 106 |
logrus.Debugf("pull.go: !confirmedV2")
|
| 107 |
- return nil, ErrUnSupportedRegistry |
|
| 107 |
+ return nil, ErrUnsupportedRegistry |
|
| 108 | 108 |
} |
| 109 | 109 |
logrus.Debugf("Trying to pull %s from %s %s", repoInfo.Name(), endpoint.URL, endpoint.Version)
|
| 110 | 110 |
break |
| ... | ... |
@@ -143,6 +143,9 @@ func Pull(name string, rs registry.Service, metaheader http.Header, authConfig * |
| 143 | 143 |
logrus.Debugf("pull.go: error in json.Unmarshal(): %v", err)
|
| 144 | 144 |
return nil, err |
| 145 | 145 |
} |
| 146 |
+ if m.Config.MediaType != MediaTypeConfig {
|
|
| 147 |
+ return nil, ErrUnsupportedMediaType |
|
| 148 |
+ } |
|
| 146 | 149 |
|
| 147 | 150 |
pd := &pullData{
|
| 148 | 151 |
repository: repository, |
| ... | ... |
@@ -51,7 +51,7 @@ func Push(name string, rs registry.Service, metaHeader http.Header, authConfig * |
| 51 | 51 |
return "", err |
| 52 | 52 |
} |
| 53 | 53 |
if !confirmedV2 {
|
| 54 |
- return "", ErrUnSupportedRegistry |
|
| 54 |
+ return "", ErrUnsupportedRegistry |
|
| 55 | 55 |
} |
| 56 | 56 |
logrus.Debugf("Trying to push %s to %s %s", repoInfo.Name(), endpoint.URL, endpoint.Version)
|
| 57 | 57 |
// This means that we found an endpoint. and we are ready to push |
| ... | ... |
@@ -4,8 +4,11 @@ package distribution |
| 4 | 4 |
|
| 5 | 5 |
import "errors" |
| 6 | 6 |
|
| 7 |
-// ErrUnSupportedRegistry indicates that the registry does not support v2 protocol |
|
| 8 |
-var ErrUnSupportedRegistry = errors.New("Only V2 repositories are supported for plugin distribution")
|
|
| 7 |
+// ErrUnsupportedRegistry indicates that the registry does not support v2 protocol |
|
| 8 |
+var ErrUnsupportedRegistry = errors.New("only V2 repositories are supported for plugin distribution")
|
|
| 9 |
+ |
|
| 10 |
+// ErrUnsupportedMediaType indicates we are pulling content that's not a plugin |
|
| 11 |
+var ErrUnsupportedMediaType = errors.New("content is not a plugin")
|
|
| 9 | 12 |
|
| 10 | 13 |
// Plugin related media types |
| 11 | 14 |
const ( |