From 2a8f74f54a0b4e8f11cd478ed22192020b72f0ce Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 23 Oct 2014 09:12:41 -0700 Subject: [PATCH] providers/virtualbox: style --- .../virtualbox/driver/version_4_3.rb | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/plugins/providers/virtualbox/driver/version_4_3.rb b/plugins/providers/virtualbox/driver/version_4_3.rb index c7fafefab..70bded802 100644 --- a/plugins/providers/virtualbox/driver/version_4_3.rb +++ b/plugins/providers/virtualbox/driver/version_4_3.rb @@ -316,7 +316,8 @@ module VagrantPlugins def read_guest_ip(adapter_number) ip = read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP") if !valid_ip_address?(ip) - raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP" + raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, + guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP" end return ip @@ -562,16 +563,6 @@ module VagrantPlugins end end - def valid_ip_address?(ip) - # Filter out invalid IP addresses - # GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests. - if ip == "0.0.0.0" - return false - else - return true - end - end - def verify! # This command sometimes fails if kernel drivers aren't properly loaded # so we just run the command and verify that it succeeded. @@ -602,6 +593,18 @@ module VagrantPlugins execute("showvminfo", uuid) return true end + + protected + + def valid_ip_address?(ip) + # Filter out invalid IP addresses + # GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests. + if ip == "0.0.0.0" + return false + else + return true + end + end end end end