fix: delete volume only after snapshot step

Signed-off-by: Alexandre NICOLAIE <alexandre.nicolaie@gmail.com>
This commit is contained in:
Alexandre NICOLAIE 2019-07-21 10:42:34 +02:00
parent 39b8c0ecca
commit b010442e07
1 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,12 @@ func (s *stepRemoveVolume) Run(ctx context.Context, state multistep.StateBag) mu
}
func (s *stepRemoveVolume) Cleanup(state multistep.StateBag) {
if _, ok := state.GetOk("snapshot_name"); !ok {
// volume will be detached to server only after sharpshooting ... so we don't
// need to remove volume before snapshot step.
return
}
client := state.Get("client").(*api.ScalewayAPI)
ui := state.Get("ui").(packer.Ui)
c := state.Get("config").(*Config)