Class: VagrantPlugins::WinAzure::Action::StartInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-azure/action/start_instance.rb

Overview

This starts a stopped instance

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ StartInstance

Returns a new instance of StartInstance.



17
18
19
20
# File 'lib/vagrant-azure/action/start_instance.rb', line 17

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant_azure:action::start_instance')
end

Instance Method Details

#call(env) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-azure/action/start_instance.rb', line 22

def call(env)
  env[:machine].id = "#{env[:machine].provider_config.vm_name}@#{env[:machine].provider_config.cloud_service_name}" unless env[:machine].id
  env[:machine].id =~ /@/

  VagrantPlugins::WinAzure::CLOUD_SERVICE_SEMAPHORE.synchronize do
    env[:ui].info "Attempting to start '#{$`}' in '#{$'}'"
    env[:azure_vm_service].start_virtual_machine($`, $')
  end
  @app.call(env)
end