From b010442e07c0fcc92c2a556dde5de81171facccf Mon Sep 17 00:00:00 2001 From: Alexandre NICOLAIE Date: Sun, 21 Jul 2019 10:42:34 +0200 Subject: [PATCH] fix: delete volume only after snapshot step Signed-off-by: Alexandre NICOLAIE --- builder/scaleway/step_remove_volume.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builder/scaleway/step_remove_volume.go b/builder/scaleway/step_remove_volume.go index accffbc6f..4767464a0 100644 --- a/builder/scaleway/step_remove_volume.go +++ b/builder/scaleway/step_remove_volume.go @@ -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)