From f1d71f9481c3ecce38b133f66b73af514794c8d6 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Thu, 9 Jan 2014 00:26:51 -0300 Subject: [PATCH 1/2] core: Reintroduce `name` attribute for the `Guest` Maintain compatibility for vagrant-vbguest plugin which uses it. vagrant-vbguest doesn't use the caps system (to keep compatibility with older Vagrant versions), but includes similar functionality itself. --- lib/vagrant/guest.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/vagrant/guest.rb b/lib/vagrant/guest.rb index 85a6eb8da..f7be29ba1 100644 --- a/lib/vagrant/guest.rb +++ b/lib/vagrant/guest.rb @@ -45,5 +45,12 @@ module Vagrant def ready? !!capability_host_chain end + + # Returns the specified or detected guest type name + # + # @return [Symbol] + def name + capability_host_chain[0][0] + end end end From c638df9dcb0ac208adf32ce90fe6dbf30e1fa914 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Thu, 9 Jan 2014 00:53:39 -0300 Subject: [PATCH 2/2] core: Tweak host/guest capability logging - Use downcase logger name as everywhere else - Remove duplicate logging from the Guest --- lib/vagrant/capability_host.rb | 5 +++-- lib/vagrant/guest.rb | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/vagrant/capability_host.rb b/lib/vagrant/capability_host.rb index af2bc771a..6c2161f7e 100644 --- a/lib/vagrant/capability_host.rb +++ b/lib/vagrant/capability_host.rb @@ -25,7 +25,8 @@ module Vagrant # is a hash where the key is the name of the capability and the value # is the class/module implementing it. def initialize_capabilities!(host, hosts, capabilities, *args) - @cap_logger = Log4r::Logger.new("vagrant::capability_host::#{self.class}") + @cap_logger = Log4r::Logger.new( + "vagrant::capability_host::#{self.class.to_s.downcase}") if host && !hosts[host] raise Errors::CapabilityHostExplicitNotDetected, value: host.to_s @@ -113,7 +114,7 @@ module Vagrant protected def autodetect_capability_host(hosts, *args) - @cap_logger.info("Autodetecting guest for machine: #{@machine}") + @cap_logger.info("Autodetecting host type for #{args.inspect}") # Get the mapping of hosts with the most parents. We start searching # with the hosts with the most parents first. diff --git a/lib/vagrant/guest.rb b/lib/vagrant/guest.rb index f7be29ba1..1265e65dc 100644 --- a/lib/vagrant/guest.rb +++ b/lib/vagrant/guest.rb @@ -22,7 +22,6 @@ module Vagrant include CapabilityHost def initialize(machine, guests, capabilities) - @logger = Log4r::Logger.new("vagrant::guest") @capabilities = capabilities @guests = guests @machine = machine @@ -31,8 +30,6 @@ module Vagrant # This will detect the proper guest OS for the machine and set up # the class to actually execute capabilities. def detect! - @logger.info("Detect guest for machine: #{@machine}") - guest_name = @machine.config.vm.guest initialize_capabilities!(guest_name, @guests, @capabilities, @machine) end