Skip to content

Commit

Permalink
fix: delete forced volume removal (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
yfodil committed Jan 11, 2023
1 parent 45f1d1e commit eb35b4c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
1 change: 1 addition & 0 deletions builder/scaleway/builder_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ source "scaleway" "basic" {
image_name = "Acceptance test"
ssh_username = "root"
zone = "fr-par-1"
remove_volume = true
}
build {
Expand Down
13 changes: 0 additions & 13 deletions builder/scaleway/step_create_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu
}

func (s *stepCreateServer) Cleanup(state multistep.StateBag) {
volumeID := state.Get("root_volume_id").(string)

if s.serverID == "" {
return
}
Expand All @@ -150,15 +148,4 @@ func (s *stepCreateServer) Cleanup(state multistep.StateBag) {
"Error destroying server. Please destroy it manually: %s", err))
}
}

ui.Say("Removing volume ...")

err = instanceAPI.DeleteVolume(&instance.DeleteVolumeRequest{
VolumeID: volumeID,
})
if err != nil {
err := fmt.Errorf("error removing volume: %s", err)
state.Put("error", err)
ui.Error(fmt.Sprintf("Error removing volume: %s. Please destroy it manually", err))
}
}

0 comments on commit eb35b4c

Please sign in to comment.