Sha256: 570adc914875dd970014c04203ff8e93e83d889d6a78201a460de7c9571bd33f

Contents?: true

Size: 894 Bytes

Versions: 5

Compression:

Stored size: 894 Bytes

Contents

require 'log4r'

module VagrantPlugins
  module Qubes
    module Action
      class Address
        def initialize(app, _env, multi)
          @app = app
          @logger = Log4r::Logger.new('vagrant_qubes::action::address')
          @multi = multi
        end
  
        def call(env)
          address(env)
          @app.call(env)
        end
  
        def address(env)
          @logger.info('vagrant-qubes, address: start...')

          # Get config.
          machine = env[:machine]
          config = env[:machine].provider_config

          # return nil if machine is down.
          return nil if machine.state.id != :running

          ssh_info = machine.ssh_info
          return nil if !ssh_info

          if @multi == true
            env[:ui].info ssh_info[:host]
          else
            env[:ui].info ssh_info[:host]
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-qubes-0.0.5 lib/vagrant-qubes/action/address.rb
vagrant-qubes-0.0.4 lib/vagrant-qubes/action/address.rb
vagrant-qubes-0.0.3 lib/vagrant-qubes/action/address.rb
vagrant-qubes-0.0.2 lib/vagrant-qubes/action/address.rb
vagrant-qubes-0.0.1 lib/vagrant-qubes/action/address.rb