Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #8117 from soltysh/bug1318537
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Mar 20, 2016
2 parents 780a7ae + 6e84e1f commit 2ddfc71
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/cmd/cli/cmd/importimage.go
Expand Up @@ -344,6 +344,11 @@ func (o *ImportImageOptions) createImageImport() (*imageapi.ImageStream, *imagea
if len(from) == 0 {
from = stream.Spec.DockerImageRepository
}
// if the from is still empty this means there's no such tag defined
// nor we can't create any from .spec.dockerImageRepository
if len(from) == 0 {
return nil, nil, fmt.Errorf("the tag %q does not exist on the image stream - choose an existing tag to import or use the 'tag' command to create a new tag", tag)
}
existing = &imageapi.TagReference{
From: &kapi.ObjectReference{
Kind: "DockerImage",
Expand Down
18 changes: 18 additions & 0 deletions pkg/cmd/cli/cmd/importimage_test.go
Expand Up @@ -114,6 +114,24 @@ func TestCreateImageImport(t *testing.T) {
},
},
},
{
// 5: import latest from image stream which has only tags specified and no latest
name: "testis:latest",
stream: &imageapi.ImageStream{
ObjectMeta: kapi.ObjectMeta{
Name: "testis",
Namespace: "other",
},
Spec: imageapi.ImageStreamSpec{
Tags: map[string]imageapi.TagReference{
"nonlatest": {
From: &kapi.ObjectReference{Kind: "DockerImage", Name: "repo.com/somens/someimage:latest"},
},
},
},
},
err: "does not exist on the image stream",
},
}

for idx, test := range testCases {
Expand Down

0 comments on commit 2ddfc71

Please sign in to comment.