From 4bb70fb2523251df47d4ebdd1e9cd17d25790283 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Wed, 31 Jul 2013 23:00:20 -0300 Subject: [PATCH] Moar debugging when trying to fetch the IP from dnsmasq leases --- lib/vagrant-lxc/action/fetch_ip_from_dnsmasq_leases.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-lxc/action/fetch_ip_from_dnsmasq_leases.rb b/lib/vagrant-lxc/action/fetch_ip_from_dnsmasq_leases.rb index cfc9bc6..9abb110 100644 --- a/lib/vagrant-lxc/action/fetch_ip_from_dnsmasq_leases.rb +++ b/lib/vagrant-lxc/action/fetch_ip_from_dnsmasq_leases.rb @@ -13,10 +13,12 @@ module Vagrant end def assigned_ip(env) - @logger.debug 'Loading ip from dnsmasq leases' mac_address = env[:machine].provider.driver.mac_address ip = nil 10.times do + dnsmasq_leases = read_dnsmasq_leases + @logger.debug 'Attempting to load ip from dnsmasq leases' + @logger.debug dnsmasq_leases if dnsmasq_leases =~ /#{Regexp.escape mac_address}\s+([0-9.]+)\s+/ ip = $1.to_s break @@ -34,7 +36,7 @@ module Vagrant /var/db/dnsmasq.leases ) - def dnsmasq_leases + def read_dnsmasq_leases LEASES_PATHS.map do |path| File.read(path) if File.exists?(path) end.join("\n")