Class: VagrantPlugins::Dustcloud::Action::ConnectDustcloud

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-dustcloud/action/connect_dustcloud.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ConnectDustcloud

Returns a new instance of ConnectDustcloud.



10
11
12
13
# File 'lib/vagrant-dustcloud/action/connect_dustcloud.rb', line 10

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

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vagrant-dustcloud/action/connect_dustcloud.rb', line 15

def call(env)
    
    api_token = env[:machine].provider_config.token.to_s
    env[:dustcloud] = DustcloudAPI.new(api_token)

    pw_file = env[:machine].data_dir.join('ssh_password')
    if pw_file.file?
        env[:machine_ssh_password] = pw_file.read
    end

    @app.call(env)
end