Class: VagrantPlugins::ProviderLibvirt::Action::IsCreated

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-libvirt/action/is_created.rb

Overview

This can be used with “Call” built-in to check if the machine is created and branch in the middleware.

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ IsCreated

Returns a new instance of IsCreated.


7
8
9
# File 'lib/vagrant-libvirt/action/is_created.rb', line 7

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

Instance Method Details

#call(env) ⇒ Object


11
12
13
14
# File 'lib/vagrant-libvirt/action/is_created.rb', line 11

def call(env)
  env[:result] = env[:machine].state.id != :not_created
  @app.call(env)
end