lib/chef_metal.rb in chef-metal-0.4 vs lib/chef_metal.rb in chef-metal-0.5
- old
+ new
@@ -30,12 +30,12 @@
ChefMetal.enclosing_provisioner_options = old_provisioner_options
end
end
end
- def self.inline_resource(provider, &block)
- InlineResource.new(provider).instance_eval(&block)
+ def self.inline_resource(action_handler, &block)
+ InlineResource.new(action_handler).instance_eval(&block)
end
@@enclosing_provisioner = nil
def self.enclosing_provisioner
@@enclosing_provisioner
@@ -46,9 +46,23 @@
@@enclosing_provisioner_options = nil
def self.enclosing_provisioner_options
@@enclosing_provisioner_options
end
+
def self.enclosing_provisioner_options=(provisioner_options)
@@enclosing_provisioner_options = provisioner_options
+ end
+
+ @@registered_provisioner_classes = {}
+ def self.add_registered_provisioner_class(name, provisioner)
+ @@registered_provisioner_classes[name] = provisioner
+ end
+
+ def self.provisioner_for_node(node)
+ provisioner_url = node['normal']['provisioner_output']['provisioner_url']
+ cluster_type = provisioner_url.split(':', 2)[0]
+ require "chef_metal/provisioner_init/#{cluster_type}_init"
+ provisioner_class = @@registered_provisioner_classes[cluster_type]
+ provisioner_class.inflate(node)
end
end