lib/chef_metal.rb in chef-metal-0.11.beta.2 vs lib/chef_metal.rb in chef-metal-0.11.beta.3

- old
+ new

@@ -28,25 +28,29 @@ @@registered_driver_classes = {} def self.register_driver_class(name, driver) @@registered_driver_classes[name] = driver end - def self.config_for_url(driver_url, config = Chef::Config) + def self.config_for_url(driver_url, config = Cheffish.profiled_config) if config && config[:drivers] && config[:drivers][driver_url] config = Cheffish::MergedConfig.new(config[:drivers][driver_url], config) end config || {} end - def self.driver_for_url(driver_url, config = Chef::Config) + def self.default_driver(config = Cheffish.profiled_config) + driver_for_url(config[:driver], config) + end + + def self.driver_for_url(driver_url, config = Cheffish.profiled_config) cluster_type = driver_url.split(':', 2)[0] require "chef_metal/driver_init/#{cluster_type}" driver_class = @@registered_driver_classes[cluster_type] config = config_for_url(driver_url, config) driver_class.from_url(driver_url, config || {}) end - def self.connect_to_machine(machine_spec, config = Chef::Config) + def self.connect_to_machine(machine_spec, config = Cheffish.profiled_config) driver = driver_for_url(machine_spec.driver_url, config) if driver machine_options = { :convergence_options => { :chef_server => Cheffish.default_chef_server(config) } } machine_options = Cheffish::MergedConfig.new(config[:machine_options], machine_options) if config[:machine_options] driver.connect_to_machine(machine_spec, machine_options)