lib/kitchen/provisioner/finder.rb in kitchen-nodes-0.6.3 vs lib/kitchen/provisioner/finder.rb in kitchen-nodes-0.6.4.dev
- old
+ new
@@ -2,17 +2,24 @@
module Provisioner
# Locates active IPs that are not localhost
# there are separate implementations for
# different kitchen transports
module Finder
+ @finder_registry = {}
+
def self.for_transport(transport, state)
- transport_string = transport.class.name.split('::').last
- require("kitchen/provisioner/finder/#{transport_string.downcase}")
+ @finder_registry.each do |registered_transport, finder|
+ if transport.class <= registered_transport
+ return finder.new(transport.connection(state))
+ end
+ end
+ end
- connection = transport.connection(state)
- klass = const_get(transport_string)
- object = klass.new(connection)
- object
+ def self.register_finder(transport, finder)
+ @finder_registry[transport] = finder
end
end
end
end
+
+require 'kitchen/provisioner/finder/ssh'
+require 'kitchen/provisioner/finder/winrm'