summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-12-23 09:33:29 -0600
committerbaude <bbaude@redhat.com>2019-12-23 10:02:14 -0600
commit4f09cfdaccfdd0f1deb01e52c7e1b18a9cec7d49 (patch)
tree491fcc6d89f0cabb26fdf2578e830b332205d589 /cmd
parentfcd48db4d24f6dba4fb2652d72aa0d86e167aa0c (diff)
downloadpodman-4f09cfdaccfdd0f1deb01e52c7e1b18a9cec7d49.tar.gz
podman-4f09cfdaccfdd0f1deb01e52c7e1b18a9cec7d49.tar.bz2
podman-4f09cfdaccfdd0f1deb01e52c7e1b18a9cec7d49.zip
add struct response for removal of images
when removing an image from storage, we should return a struct that details what was untagged vs deleted. this replaces the simple println's used previously and assists in API development. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/rmi.go11
-rw-r--r--cmd/podman/varlink/io.podman.varlink10
2 files changed, 19 insertions, 2 deletions
diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go
index 3f621116e..f4ca88ea8 100644
--- a/cmd/podman/rmi.go
+++ b/cmd/podman/rmi.go
@@ -68,7 +68,7 @@ func rmiCmd(c *cliconfig.RmiValues) error {
images := args[:]
removeImage := func(img *adapter.ContainerImage) {
- msg, err := runtime.RemoveImage(ctx, img, c.Force)
+ response, err := runtime.RemoveImage(ctx, img, c.Force)
if err != nil {
if errors.Cause(err) == storage.ErrImageUsedByContainer {
fmt.Printf("A container associated with containers/storage, i.e. via Buildah, CRI-O, etc., may be associated with this image: %-12.12s\n", img.ID())
@@ -83,7 +83,14 @@ func rmiCmd(c *cliconfig.RmiValues) error {
lastError = err
return
}
- fmt.Println(msg)
+ // Iterate if any images tags were deleted
+ for _, i := range response.Untagged {
+ fmt.Printf("Untagged: %s\n", i)
+ }
+ // Make sure an image was deleted (and not just untagged); else print it
+ if len(response.Deleted) > 0 {
+ fmt.Printf("Deleted: %s\n", response.Deleted)
+ }
}
if removeAll {
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index 2251050c3..1bacd2de6 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -18,6 +18,11 @@ type StringResponse (
message: string
)
+type RemoveImageResponse (
+ untagged: []string,
+ deleted: string
+)
+
type LogLine (
device: string,
parseLogType : string,
@@ -867,6 +872,11 @@ method TagImage(name: string, tagged: string) -> (image: string)
# ~~~
method RemoveImage(name: string, force: bool) -> (image: string)
+# RemoveImageWithResponse takes the name or ID of an image as well as a boolean that determines if containers using that image
+# should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. The reponse is
+# in the form of a RemoveImageResponse .
+method RemoveImageWithResponse(name: string, force: bool) -> (response: RemoveImageResponse)
+
# SearchImages searches available registries for images that contain the
# contents of "query" in their name. If "limit" is given, limits the amount of
# search results per registry.