Sha256: 96a466c679a9514d1c305874bf1f52ff87b0e01ca3c023fd00d32978d647af1d

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

require "log4r"

module VagrantPlugins
  module GANETI
    module Action
      # This action reads the SSH info for the machine and puts it into the
      # `:machine_ssh_info` key in the environment.
      class ReadSSHInfo
        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant_ganeti::action::read_ssh_info")
        end

        def call(env)
          env[:machine_ssh_info] = read_ssh_info(env[:ganeti_compute], env[:machine])

          @app.call(env)
        end

        def read_ssh_info(ganeti, machine)
          return nil if machine.id.nil?
          puts "Ganeti is #{machine.id}"
          # Read the DNS info
          return {
            :host => machine.id,
            :port => 22
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-ganeti-0.1.1 lib/vagrant-ganeti/action/read_ssh_info.rb
vagrant-ganeti-0.0.1 lib/vagrant-plugin-ganeti/action/read_ssh_info.rb