Sha256: e0df8aef7fc3c2f6d9b0144de133fa57704b83b611997920afab1e4da6b5cac9
Contents?: true
Size: 834 Bytes
Versions: 2
Compression:
Stored size: 834 Bytes
Contents
# frozen_string_literal: true require 'log4r' require 'json' module VagrantPlugins module Packet module Action # This terminates the running instance. class TerminateInstance def initialize(app, _env) @app = app @logger = Log4r::Logger.new('vagrant_packet::action::terminate_instance') end def call(env) server = env[:packet_compute].devices.get(env[:machine].id) # Destroy the server and remove the tracking ID env[:ui].info(I18n.t('vagrant_packet.terminating')) begin server.destroy env[:machine].id = nil rescue Exception => e env[:ui].info(I18n.t('vagrant_packet.terminate_while_provisioning')) end @app.call(env) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-packet-0.1.6 | lib/vagrant-packet/action/terminate_instance.rb |
vagrant-packet-0.1.5 | lib/vagrant-packet/action/terminate_instance.rb |