From e27ee5c840ac1ea10f3055287cc8256cddeeb083 Mon Sep 17 00:00:00 2001
From: baude <bbaude@redhat.com>
Date: Mon, 5 Aug 2019 09:57:43 -0500
Subject: make rmi messages more compatible with docker

in the case where we rmi an image that has only one reponame, we print
out an untagged reponame message.

$ sudo podman rmi busybox
Untagged: docker.io/library/busybox:latest
Deleted: db8ee88ad75f6bdc74663f4992a185e2722fa29573abcc1a19186cc5ec09dceb

Signed-off-by: baude <bbaude@redhat.com>
---
 libpod/runtime_img.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'libpod')

diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 4055734eb..20dee4080 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -28,6 +28,7 @@ import (
 // RemoveImage deletes an image from local storage
 // Images being used by running containers can only be removed if force=true
 func (r *Runtime) RemoveImage(ctx context.Context, img *image.Image, force bool) (string, error) {
+	var returnMessage string
 	r.lock.Lock()
 	defer r.lock.Unlock()
 
@@ -93,7 +94,11 @@ func (r *Runtime) RemoveImage(ctx context.Context, img *image.Image, force bool)
 			err = errStorage
 		}
 	}
-	return img.ID(), err
+	for _, name := range img.Names() {
+		returnMessage = returnMessage + fmt.Sprintf("Untagged: %s\n", name)
+	}
+	returnMessage = returnMessage + fmt.Sprintf("Deleted: %s", img.ID())
+	return returnMessage, err
 }
 
 // Remove containers that are in storage rather than Podman.
-- 
cgit v1.2.3-54-g00ecf