summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/images_pull.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-09-18 11:47:55 -0700
committerJhon Honce <jhonce@redhat.com>2020-09-21 08:51:52 -0700
commite06230c9d5768af3e480e58b8e781e81737fc0d3 (patch)
tree0c93a64c5915dc2118854bc4a65a75d348d22510 /pkg/api/handlers/libpod/images_pull.go
parent051912c8e6998047d31cb7b8330ffcf65a4ead40 (diff)
downloadpodman-e06230c9d5768af3e480e58b8e781e81737fc0d3.tar.gz
podman-e06230c9d5768af3e480e58b8e781e81737fc0d3.tar.bz2
podman-e06230c9d5768af3e480e58b8e781e81737fc0d3.zip
Restore 'id' stanza in pull results
id is the last image id from the set of id's returned via the images stanza. id may be deprecated in a future version of the API Created test_rest_v2_0_0.py to reflect the bump in the API Version. Fixes #7686 Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod/images_pull.go')
-rw-r--r--pkg/api/handlers/libpod/images_pull.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/api/handlers/libpod/images_pull.go b/pkg/api/handlers/libpod/images_pull.go
index 8a2f4f4cf..ad8d1f38e 100644
--- a/pkg/api/handlers/libpod/images_pull.go
+++ b/pkg/api/handlers/libpod/images_pull.go
@@ -178,10 +178,19 @@ loop: // break out of for/select infinite loop
flush()
case <-runCtx.Done():
if !failed {
+ // Send all image id's pulled in 'images' stanza
report.Images = images
if err := enc.Encode(report); err != nil {
logrus.Warnf("Failed to json encode error %q", err.Error())
}
+
+ report.Images = nil
+ // Pull last ID from list and publish in 'id' stanza. This maintains previous API contract
+ report.ID = images[len(images)-1]
+ if err := enc.Encode(report); err != nil {
+ logrus.Warnf("Failed to json encode error %q", err.Error())
+ }
+
flush()
}
break loop // break out of for/select infinite loop