Class: VagrantPlugins::OCI::Action::TerminateInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-oci/action/terminate_instance.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ TerminateInstance

Returns a new instance of TerminateInstance.



7
8
9
10
# File 'lib/vagrant-oci/action/terminate_instance.rb', line 7

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant_oci::action::terminate_instance")
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-oci/action/terminate_instance.rb', line 12

def call(env)
  server_ocid = env[:machine].id
  return nil if server_ocid.nil?

  env[:ui].info(I18n.t("vagrant_oci.terminating"))
  env[:oci_compute].terminate_instance(server_ocid)
  env[:machine].id = nil

  @app.call(env)
end