Class: VagrantPlugins::OCI::Action::IsTerminated

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ IsTerminated

Returns a new instance of IsTerminated.



5
6
7
# File 'lib/vagrant-oci/action/is_terminated.rb', line 5

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
# File 'lib/vagrant-oci/action/is_terminated.rb', line 9

def call(env)
  ocid = env[:machine].id
  instance_data = env[:oci_compute].get_instance(ocid).data.to_hash
  env[:result] = %w[TERMINATED TERMINATING].include? instance_data[:lifecycleState].upcase
  @app.call(env)
end