Class: VagrantPlugins::ProviderOpenStack::Action::Connect

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-openstack/action/connect.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Connect

Returns a new instance of Connect.



8
9
10
11
# File 'lib/vagrant-openstack/action/connect.rb', line 8

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant_openstack::action::connect")
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vagrant-openstack/action/connect.rb', line 13

def call(env)
  config = env[:machine].provider_config

  @logger.info("Connecting to OpenStack...")
  #env[:os_connection] = OpenStack::Connection.create({
  #                  :username => config.user,
  #                  :api_key => config.password,
  #                  :auth_method => "password",
  #                  :auth_url => config.url,
  #                  :authtenant_name => config.tenant,
  #                  :service_type => "compute"})

  env[:os_connection] = Fog::Compute.new({
    :provider => :openstack,
    :openstack_tenant => config.tenant,
    :openstack_api_key => config.password,
    :openstack_auth_url => config.url,
    :openstack_username => config.user,
    :openstack_service_type  => "compute"
  })                 
  @app.call(env)
end