From af477a59df23d8fe0f7dce52bcdd1e73aa31d275 Mon Sep 17 00:00:00 2001 From: Bob Potter Date: Tue, 24 Sep 2013 23:44:03 -0500 Subject: [PATCH] Update builder-amazon-chroot to work with WaitForState changes in 7c56148f --- builder/amazon/chroot/step_attach_volume.go | 13 +++++++------ builder/amazon/chroot/step_create_volume.go | 3 ++- builder/amazon/chroot/step_snapshot.go | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/builder/amazon/chroot/step_attach_volume.go b/builder/amazon/chroot/step_attach_volume.go index 1b1bce0f2..ab2ddb708 100644 --- a/builder/amazon/chroot/step_attach_volume.go +++ b/builder/amazon/chroot/step_attach_volume.go @@ -60,7 +60,8 @@ func (s *StepAttachVolume) Run(state multistep.StateBag) multistep.StepAction { return nil, "", errors.New("No attachments on volume.") } - return nil, resp.Volumes[0].Attachments[0].Status, nil + a := resp.Volumes[0].Attachments[0] + return a, a.Status, nil }, } @@ -111,12 +112,12 @@ func (s *StepAttachVolume) CleanupFunc(state multistep.StateBag) error { return nil, "", err } - state := "detached" - if len(resp.Volumes[0].Attachments) > 0 { - state = resp.Volumes[0].Attachments[0].Status + v := resp.Volumes[0] + if len(v.Attachments) > 0 { + return v, v.Attachments[0].Status, nil + } else { + return v, "detached", nil } - - return nil, state, nil }, } diff --git a/builder/amazon/chroot/step_create_volume.go b/builder/amazon/chroot/step_create_volume.go index 5346bf1ca..0b89cf642 100644 --- a/builder/amazon/chroot/step_create_volume.go +++ b/builder/amazon/chroot/step_create_volume.go @@ -75,7 +75,8 @@ func (s *StepCreateVolume) Run(state multistep.StateBag) multistep.StepAction { return nil, "", err } - return nil, resp.Volumes[0].Status, nil + v := resp.Volumes[0] + return v, v.Status, nil }, } diff --git a/builder/amazon/chroot/step_snapshot.go b/builder/amazon/chroot/step_snapshot.go index 22cf4d17f..e065da2df 100644 --- a/builder/amazon/chroot/step_snapshot.go +++ b/builder/amazon/chroot/step_snapshot.go @@ -51,7 +51,8 @@ func (s *StepSnapshot) Run(state multistep.StateBag) multistep.StepAction { return nil, "", errors.New("No snapshots found.") } - return nil, resp.Snapshots[0].Status, nil + s := resp.Snapshots[0] + return s, s.Status, nil }, }