Class: VagrantPlugins::WinAzure::Action::ConnectAzure

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ConnectAzure

Returns a new instance of ConnectAzure.



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

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

Instance Method Details

#call(env) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/vagrant-azure/action/connect_azure.rb', line 23

def call (env)
  if env[:azure_vm_service].nil?
    config = env[:machine].provider_config

    Azure.configure do |c|
      c.subscription_id                       = config.subscription_id
      c.management_certificate                = config.mgmt_certificate
      c.management_endpoint                   = config.mgmt_endpoint
      c.                  = config.storage_acct_name
      c.storage_access_key                    = config.storage_access_key
    end

    # FIXME:
    # Defining a new class VagrantAzureService
    # Here we call the native azure virtual machine management service method
    # and add some exception handling.
    # Remove this once the Azure SDK adds the exception handling for the
    # methods defined in VagrantAzureService
    env[:azure_vm_service] = VagrantAzureService.new(Azure::VirtualMachineManagementService.new)
  end

  @app.call(env)
end