Skip to content

Commit

Permalink
builder/triton: Wait for ImageCreation State
Browse files Browse the repository at this point in the history
A bug was reported to Joyent, that sometimes packer UI reports that an image was created but it wasn't actually available in Triton for use. We believe that there was a bug uploading that image to Manta but that the metadata of the image was already populated and thus packer was reporting success as it was just checking for the metadata presence

This PR changes Packer to wait for the state of the image to be `active` to make sure that it has fully uploaded and is ready for use

```
==> triton: Stopping source machine (61647c3c-f2bf-4e30-b4bc-f076d3b01522)...
==> triton: Waiting for source machine to stop (61647c3c-f2bf-4e30-b4bc-f076d3b01522)...
==> triton: Creating image from source machine...
==> triton: Waiting for image to become available...
==> triton: Deleting source machine...
==> triton: Waiting for source machine to be deleted...
Build 'triton' finished.

==> Builds finished. The artifacts of successful builds are:
--> triton: Image was created: c2537582-34c7-42ea-bd11-b6ed499d5831
```
  • Loading branch information
stack72 committed Nov 8, 2017
1 parent d00f884 commit 450a233
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions builder/triton/driver_triton.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"context"
"errors"
"net/http"
"time"

"sort"
"time"

"github.com/hashicorp/packer/packer"
"github.com/joyent/triton-go/client"
Expand Down Expand Up @@ -200,7 +199,7 @@ func (d *driverTriton) WaitForImageCreation(imageId string, timeout time.Duratio
if image == nil {
return false, err
}
return image.OS != "", err
return image.State == "active", err
},
3*time.Second,
timeout,
Expand Down

0 comments on commit 450a233

Please sign in to comment.