image_delete: move name check first
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
This commit is contained in:
parent
6206cbe193
commit
cb2def9f90
1 changed files with 4 additions and 5 deletions
|
@ -27,6 +27,10 @@ func (daemon *Daemon) ImageDelete(name string, force, noprune bool) ([]types.Ima
|
|||
}
|
||||
|
||||
func (daemon *Daemon) imgDeleteHelper(name string, list *[]types.ImageDelete, first, force, noprune bool) error {
|
||||
if name == "" {
|
||||
return fmt.Errorf("Image name can not be blank")
|
||||
}
|
||||
|
||||
var repoName, tag string
|
||||
repoAndTags := make(map[string][]string)
|
||||
|
||||
|
@ -36,10 +40,6 @@ func (daemon *Daemon) imgDeleteHelper(name string, list *[]types.ImageDelete, fi
|
|||
tag = tags.DefaultTag
|
||||
}
|
||||
|
||||
if name == "" {
|
||||
return fmt.Errorf("Image name can not be blank")
|
||||
}
|
||||
|
||||
img, err := daemon.Repositories().LookupImage(name)
|
||||
if err != nil {
|
||||
if r, _ := daemon.Repositories().Get(repoName); r != nil {
|
||||
|
@ -54,7 +54,6 @@ func (daemon *Daemon) imgDeleteHelper(name string, list *[]types.ImageDelete, fi
|
|||
}
|
||||
|
||||
byParents := daemon.Graph().ByParent()
|
||||
|
||||
repos := daemon.Repositories().ByID()[img.ID]
|
||||
|
||||
//If delete by id, see if the id belong only to one repository
|
||||
|
|
Loading…
Add table
Reference in a new issue