From 2840dad6f641f54fab0487bff5c98559919bc8fc Mon Sep 17 00:00:00 2001 From: Stanislas Lange Date: Sun, 4 Oct 2020 22:48:02 +0200 Subject: [PATCH] fix(destroy,halt): remove tasks status polling Since the tasks API endpoint does not exist anymore (https://github.com/kaorimatz/fog-scaleway/issues/7), polling for the task will result in an error even if the actual task succeeded. While tasks-related code should be removed from fog-scaleway, setting async to true for the server.terminate and server.poweroff methods will bypass this polling. Fixes https://github.com/kaorimatz/vagrant-scaleway/issues/9. --- lib/vagrant-scaleway/action/destroy_server.rb | 2 +- lib/vagrant-scaleway/action/stop_server.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-scaleway/action/destroy_server.rb b/lib/vagrant-scaleway/action/destroy_server.rb index 009f300..bc8211c 100644 --- a/lib/vagrant-scaleway/action/destroy_server.rb +++ b/lib/vagrant-scaleway/action/destroy_server.rb @@ -17,7 +17,7 @@ def call(env) server.destroy rescue Fog::Scaleway::Compute::InvalidRequestError => e if e.message =~ /server should be stopped/ - server.terminate(false) + server.terminate(true) else raise end diff --git a/lib/vagrant-scaleway/action/stop_server.rb b/lib/vagrant-scaleway/action/stop_server.rb index 48cd34e..af9ab84 100644 --- a/lib/vagrant-scaleway/action/stop_server.rb +++ b/lib/vagrant-scaleway/action/stop_server.rb @@ -14,7 +14,7 @@ def call(env) env[:ui].info(I18n.t('vagrant_scaleway.already_status', status: env[:machine].state.id)) else env[:ui].info(I18n.t('vagrant_scaleway.stopping')) - server.poweroff(false) + server.poweroff(true) end @app.call(env)