class VagrantPlugins::OpenNebulaProvider::Action::ReadSSHInfo

Public Class Methods

new(app, env) click to toggle source
# 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

Public Instance Methods

call(env) click to toggle source
# File lib/opennebula-provider/action/read_ssh_info.rb, line 10
def call(env)
  env[:machine_ssh_info] = read_ssh_info(env[:machine])
  @app.call(env)
end
read_ssh_info(machine) click to toggle source
# File lib/opennebula-provider/action/read_ssh_info.rb, line 15
def read_ssh_info(machine)
  return nil if machine.id.nil?
  driver = machine.provider.driver

  host = driver.ssh_info(machine.id)
  { host: host, port: 22 } unless host.nil?
end