Class: VagrantPlugins::Joyent::Action::ConnectJoyent

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-joyent/action/connect_joyent.rb

Overview

This action connects to Joyent, verifies credentials work, and puts the Joyent connection object into the ‘:joyent_compute` key in the environment.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ConnectJoyent

Returns a new instance of ConnectJoyent.



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

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

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vagrant-joyent/action/connect_joyent.rb', line 16

def call(env)

  @logger.info("Connecting to Joyent...")
  env[:joyent_compute] = Fog::Compute.new({
      :provider => 'Joyent',
      :joyent_username => env[:machine].provider_config.username,
      :joyent_password => env[:machine].provider_config.password,
      :joyent_keyname => env[:machine].provider_config.keyname,
      :joyent_keyfile => env[:machine].provider_config.keyfile,
      :joyent_url => env[:machine].provider_config.api_url
    })

  @app.call(env)
end