Class: VagrantPlugins::OCI::Action::IsStopped

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ IsStopped

Returns a new instance of IsStopped.



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

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

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  ocid = env[:machine].id

  instance_data = env[:oci_compute].get_instance(ocid).data.to_hash
  env[:result] = %w[STOPPED STOPPING].include? instance_data[:lifecycleState].upcase
  @app.call(env)
end