Sha256: 9db9bf6ae70db3bea9476e223a202276b42d462c725075d333b613bb7b4090c2

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

require 'log4r'

module VagrantPlugins
  module Openstack
    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_openstack::action::read_ssh_info')
        end

        def call(env)
          env[:machine_ssh_info] = read_ssh_info(env)

          @app.call(env)
        end

        def read_ssh_info(env)
          config = env[:machine].provider_config
          {
            # Usually there should only be one public IP
            host: config.floating_ip,
            port: 22,
            username: config.ssh_username
          }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-openstack-provider-0.2.0 lib/vagrant-openstack-provider/action/read_ssh_info.rb