Merge pull request #459 from bpot/fix_amazon_chroot

builder/amazon-chroot: fix builder-amazon-chroot find states
This commit is contained in:
Mitchell Hashimoto 2013-09-25 00:28:13 -07:00
commit a9122b8c1a
3 changed files with 11 additions and 8 deletions

View File

@ -60,7 +60,8 @@ func (s *StepAttachVolume) Run(state multistep.StateBag) multistep.StepAction {
return nil, "", errors.New("No attachments on volume.") 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 return nil, "", err
} }
state := "detached" v := resp.Volumes[0]
if len(resp.Volumes[0].Attachments) > 0 { if len(v.Attachments) > 0 {
state = resp.Volumes[0].Attachments[0].Status return v, v.Attachments[0].Status, nil
} else {
return v, "detached", nil
} }
return nil, state, nil
}, },
} }

View File

@ -75,7 +75,8 @@ func (s *StepCreateVolume) Run(state multistep.StateBag) multistep.StepAction {
return nil, "", err return nil, "", err
} }
return nil, resp.Volumes[0].Status, nil v := resp.Volumes[0]
return v, v.Status, nil
}, },
} }

View File

@ -51,7 +51,8 @@ func (s *StepSnapshot) Run(state multistep.StateBag) multistep.StepAction {
return nil, "", errors.New("No snapshots found.") return nil, "", errors.New("No snapshots found.")
} }
return nil, resp.Snapshots[0].Status, nil s := resp.Snapshots[0]
return s, s.Status, nil
}, },
} }