summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/images.go
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2020-02-06 17:35:46 -0500
committerNalin Dahyabhai <nalin@redhat.com>2020-02-06 17:41:46 -0500
commite6c7ccc06700ee7e91a265462d1eed5fb574a4bb (patch)
treed157ea97e331d6e168abb6c799bcc46c49b390c5 /pkg/varlinkapi/images.go
parent0d006f742ae0de9be2cc4858da4e64e07410e090 (diff)
downloadpodman-e6c7ccc06700ee7e91a265462d1eed5fb574a4bb.tar.gz
podman-e6c7ccc06700ee7e91a265462d1eed5fb574a4bb.tar.bz2
podman-e6c7ccc06700ee7e91a265462d1eed5fb574a4bb.zip
LibpodAPI.BuildImage: don't require a name for the new image
When we finish building an image, we try to look up its ID by looking up the image using the name that we were asked to assign to the image. If we weren't asked to assign a name to the image, that would produce an error. The BuildImage() API we're using returns the image's ID anyway, so we can skip the lookup and just return the ID directly. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'pkg/varlinkapi/images.go')
-rw-r--r--pkg/varlinkapi/images.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index 333595a96..b144bfa5e 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -143,6 +143,7 @@ func (i *LibpodAPI) GetImage(call iopodman.VarlinkCall, id string) error {
func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildInfo) error {
var (
namespace []buildah.NamespaceOption
+ imageID string
err error
)
@@ -249,7 +250,8 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI
c := make(chan error)
go func() {
- _, _, err := i.Runtime.Build(getContext(), options, newPathDockerFiles...)
+ iid, _, err := i.Runtime.Build(getContext(), options, newPathDockerFiles...)
+ imageID = iid
c <- err
close(c)
}()
@@ -291,13 +293,9 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI
}
call.Continues = false
- newImage, err := i.Runtime.ImageRuntime().NewFromLocal(config.Output)
- if err != nil {
- return call.ReplyErrorOccurred(err.Error())
- }
br := iopodman.MoreResponse{
Logs: log,
- Id: newImage.ID(),
+ Id: imageID,
}
return call.ReplyBuildImage(br)
}