Class: VagrantPlugins::OpenNebulaProvider::Action::ReadSSHInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/opennebula-provider/action/read_ssh_info.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ReadSSHInfo

Returns a new instance of ReadSSHInfo.



5
6
7
8
# File 'lib/opennebula-provider/action/read_ssh_info.rb', line 5

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant::provider::opennebula::read_ssh_info')
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
# File 'lib/opennebula-provider/action/read_ssh_info.rb', line 10

def call(env)
  env[:machine_ssh_info] = read_ssh_info(env[:rocci], env[:machine])
  @app.call(env)
end

#read_ssh_info(rocci, machine) ⇒ Object



15
16
17
18
19
20
# File 'lib/opennebula-provider/action/read_ssh_info.rb', line 15

def read_ssh_info(rocci, machine)
  return nil if machine.id.nil?

  host = rocci.ssh_info(machine.id)
  { host: host, port: 22 }
end