From 30e0324a1b0865574d3adb95f3cffbe6656bdd05 Mon Sep 17 00:00:00 2001 From: Mark Gilbert <50398495+MarkProminic@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:22:24 -0500 Subject: [PATCH] fix: linting - add destroy confirmation --- lib/vagrant-zones/action.rb | 12 ++++-------- lib/vagrant-zones/action/message_not_created.rb | 5 ++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/vagrant-zones/action.rb b/lib/vagrant-zones/action.rb index faf0d55..a1d2307 100644 --- a/lib/vagrant-zones/action.rb +++ b/lib/vagrant-zones/action.rb @@ -116,21 +116,17 @@ def self.action_package # This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine. def self.action_destroy Vagrant::Action::Builder.new.tap do |b| - b.use Call, IsCreated do |_env, b2| - unless _env[:result] + b.use Call, IsCreated do |env1, b2| + unless env1[:result] b2.use MessageNotCreated # Try to destroy anyways b2.use Call, DestroyConfirm do |env2, b3| - if env2[:result] - b3.use Destroy - end + b3.use Destroy if env2[:result] end next end b2.use Call, DestroyConfirm do |env2, b3| - if env2[:result] - b3.use Destroy - end + b3.use Destroy if env2[:result] end end end diff --git a/lib/vagrant-zones/action/message_not_created.rb b/lib/vagrant-zones/action/message_not_created.rb index 4fd7d11..f4e16c9 100644 --- a/lib/vagrant-zones/action/message_not_created.rb +++ b/lib/vagrant-zones/action/message_not_created.rb @@ -11,13 +11,12 @@ def initialize(app, _env) @app = app @logger = Log4r::Logger.new('vagrant_zones::action') end - + def call(env) - env[:ui].info I18n.t("vagrant_zones.vm_not_created") + env[:ui].info I18n.t('vagrant_zones.vm_not_created') @app.call(env) end end end end end - \ No newline at end of file