Module: VagrantRubydns::Util

Defined in:
lib/vagrant-rubydns/util.rb

Class Method Summary collapse

Class Method Details

.host_and_ip(machine) ⇒ Object



3
4
5
# File 'lib/vagrant-rubydns/util.rb', line 3

def self.host_and_ip(machine)
  [hostname(machine), ip_address(machine)]
end

.hostname(machine) ⇒ Object



7
8
9
10
11
# File 'lib/vagrant-rubydns/util.rb', line 7

def self.hostname(machine)
  return nil unless machine

  machine.config.vm.hostname
end

.ip_address(machine) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-rubydns/util.rb', line 13

def self.ip_address(machine)
  return nil unless machine

  machine.config.vm.networks.each do |type, options|
    if type == :private_network && options[:ip].is_a?(String)
      return options[:ip]
    end
  end

  nil
end