mirror of https://github.com/containers/podman.git
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>
This commit is contained in:
parent
0d006f742a
commit
e6c7ccc067
|
@ -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 {
|
func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildInfo) error {
|
||||||
var (
|
var (
|
||||||
namespace []buildah.NamespaceOption
|
namespace []buildah.NamespaceOption
|
||||||
|
imageID string
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -249,7 +250,8 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI
|
||||||
|
|
||||||
c := make(chan error)
|
c := make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
_, _, err := i.Runtime.Build(getContext(), options, newPathDockerFiles...)
|
iid, _, err := i.Runtime.Build(getContext(), options, newPathDockerFiles...)
|
||||||
|
imageID = iid
|
||||||
c <- err
|
c <- err
|
||||||
close(c)
|
close(c)
|
||||||
}()
|
}()
|
||||||
|
@ -291,13 +293,9 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI
|
||||||
}
|
}
|
||||||
call.Continues = false
|
call.Continues = false
|
||||||
|
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(config.Output)
|
|
||||||
if err != nil {
|
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
|
||||||
}
|
|
||||||
br := iopodman.MoreResponse{
|
br := iopodman.MoreResponse{
|
||||||
Logs: log,
|
Logs: log,
|
||||||
Id: newImage.ID(),
|
Id: imageID,
|
||||||
}
|
}
|
||||||
return call.ReplyBuildImage(br)
|
return call.ReplyBuildImage(br)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue