Logging for host detection
This commit is contained in:
parent
f1dd5459f2
commit
195a0d6999
|
@ -1,3 +1,5 @@
|
||||||
|
require 'log4r'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module Hosts
|
module Hosts
|
||||||
autoload :Base, 'vagrant/hosts/base'
|
autoload :Base, 'vagrant/hosts/base'
|
||||||
|
@ -11,13 +13,19 @@ module Vagrant
|
||||||
# This method detects the correct host based on the `match?` methods
|
# This method detects the correct host based on the `match?` methods
|
||||||
# implemented in the registered hosts.
|
# implemented in the registered hosts.
|
||||||
def self.detect(registry)
|
def self.detect(registry)
|
||||||
|
logger = Log4r::Logger.new("vagrant::hosts")
|
||||||
|
|
||||||
# Sort the hosts by their precedence
|
# Sort the hosts by their precedence
|
||||||
host_klasses = registry.to_hash.values
|
host_klasses = registry.to_hash.values
|
||||||
host_klasses = host_klasses.sort_by { |a| a.precedence }.reverse
|
host_klasses = host_klasses.sort_by { |a| a.precedence }.reverse
|
||||||
|
logger.debug("Host path search classes: #{host_klasses.inspect}")
|
||||||
|
|
||||||
# Test for matches and return the host class that matches
|
# Test for matches and return the host class that matches
|
||||||
host_klasses.each do |klass|
|
host_klasses.each do |klass|
|
||||||
return klass if klass.match?
|
if klass.match?
|
||||||
|
logger.info("Host class: #{klass}")
|
||||||
|
return klass
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# No matches found...
|
# No matches found...
|
||||||
|
|
Loading…
Reference in New Issue