Class: VagrantPlugins::GlobalStatus::Action::DeregisterMachine

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-global-status/action/deregister_machine.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ DeregisterMachine

Returns a new instance of DeregisterMachine.



7
8
9
# File 'lib/vagrant-global-status/action/deregister_machine.rb', line 7

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

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-global-status/action/deregister_machine.rb', line 11

def call(env)
  @app.call(env)
  if env[:machine].provider.state.id == :not_created
    GlobalRegistry.deregister(
      home_path:    env[:home_path],
      machine_name: env[:machine].name,
      root_path:    env[:root_path]
    )
  end
end