Class: VagrantAutoDNS::Action::Add

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-autodns/actions/add.rb

Instance Method Summary collapse

Methods included from Common

#call, #hostname, included, #initialize, #machine_name

Instance Method Details

#actionObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vagrant-autodns/actions/add.rb', line 16

def action
  require_relative '../autodnsdb'
  ip = machine.guest.capability(:get_ip)

  log.info("Adding record #{hostname} for ip #{ip} to AutoDNS DB.")
  if VagrantAutoDNS.autodnsdb.update_record(hostname, ip, machine_name)
    log.info("Record #{ip} added for host #{hostname}")
  else
    log.error("Record #{ip} NOT added for host #{hostname}")
  end
end