diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-02-17 17:24:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 17:24:28 +0100 |
commit | 640b11f0028057ca2090d61c4e460c1afadb226c (patch) | |
tree | 797e7b98b6efe2b0bdb74e93146b53c798367308 /pkg/varlinkapi | |
parent | ff0f8388138f7b66c4312db0e984f0bedcac2558 (diff) | |
parent | 93358ef915f639e52088b0f6aec52e77d3da0af7 (diff) | |
download | podman-640b11f0028057ca2090d61c4e460c1afadb226c.tar.gz podman-640b11f0028057ca2090d61c4e460c1afadb226c.tar.bz2 podman-640b11f0028057ca2090d61c4e460c1afadb226c.zip |
Merge pull request #5093 from openSUSE/image-tree
Refactor image tree for API usage
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r-- | pkg/varlinkapi/images.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go index b144bfa5e..c4809f16b 100644 --- a/pkg/varlinkapi/images.go +++ b/pkg/varlinkapi/images.go @@ -1016,3 +1016,17 @@ func (i *LibpodAPI) BuildImageHierarchyMap(call iopodman.VarlinkCall, name strin } return call.ReplyBuildImageHierarchyMap(string(b)) } + +// ImageTree returns the image tree string for the provided image name or ID +func (i *LibpodAPI) ImageTree(call iopodman.VarlinkCall, nameOrID string, whatRequires bool) error { + img, err := i.Runtime.ImageRuntime().NewFromLocal(nameOrID) + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + + tree, err := img.GenerateTree(whatRequires) + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + return call.ReplyImageTree(tree) +} |