Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
| ... | ... |
@@ -27,6 +27,10 @@ func (daemon *Daemon) ImageDelete(name string, force, noprune bool) ([]types.Ima |
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
func (daemon *Daemon) imgDeleteHelper(name string, list *[]types.ImageDelete, first, force, noprune bool) error {
|
| 30 |
+ if name == "" {
|
|
| 31 |
+ return fmt.Errorf("Image name can not be blank")
|
|
| 32 |
+ } |
|
| 33 |
+ |
|
| 30 | 34 |
var repoName, tag string |
| 31 | 35 |
repoAndTags := make(map[string][]string) |
| 32 | 36 |
|
| ... | ... |
@@ -36,10 +40,6 @@ func (daemon *Daemon) imgDeleteHelper(name string, list *[]types.ImageDelete, fi |
| 36 | 36 |
tag = tags.DefaultTag |
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 |
- if name == "" {
|
|
| 40 |
- return fmt.Errorf("Image name can not be blank")
|
|
| 41 |
- } |
|
| 42 |
- |
|
| 43 | 39 |
img, err := daemon.Repositories().LookupImage(name) |
| 44 | 40 |
if err != nil {
|
| 45 | 41 |
if r, _ := daemon.Repositories().Get(repoName); r != nil {
|
| ... | ... |
@@ -54,7 +54,6 @@ func (daemon *Daemon) imgDeleteHelper(name string, list *[]types.ImageDelete, fi |
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
byParents := daemon.Graph().ByParent() |
| 57 |
- |
|
| 58 | 57 |
repos := daemon.Repositories().ByID()[img.ID] |
| 59 | 58 |
|
| 60 | 59 |
//If delete by id, see if the id belong only to one repository |