Skip to content

Commit

Permalink
fix: linting - add destroy confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkProminic authored Aug 17, 2024
1 parent f04e30a commit 30e0324
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
12 changes: 4 additions & 8 deletions lib/vagrant-zones/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions lib/vagrant-zones/action/message_not_created.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 30e0324

Please sign in to comment.