Search for repo first before image id

Upstream-commit: ca98434a45a1c836aa69d67d8cc12b8e95e5722f
Component: engine
This commit is contained in:
Michael Crosby
2013-11-29 11:06:35 -08:00
parent 34e8bb0db2
commit 8c2eb815d3

View File

@ -66,20 +66,18 @@ func (store *TagStore) Reload() error {
}
func (store *TagStore) LookupImage(name string) (*Image, error) {
img, err := store.graph.Get(name)
// FIXME: standardize on returning nil when the image doesn't exist, and err for everything else
// (so we can pass all errors here)
repos, tag := utils.ParseRepositoryTag(name)
if tag == "" {
tag = DEFAULTTAG
}
img, err := store.GetImage(repos, tag)
if err != nil {
// FIXME: standardize on returning nil when the image doesn't exist, and err for everything else
// (so we can pass all errors here)
repos, tag := utils.ParseRepositoryTag(name)
if tag == "" {
tag = DEFAULTTAG
}
if i, err := store.GetImage(repos, tag); err != nil {
return nil, err
} else if img == nil {
if img, err = store.graph.Get(name); err != nil {
return nil, err
} else if i == nil {
return nil, fmt.Errorf("Image does not exist: %s", name)
} else {
img = i
}
}
return img, nil