lib/chef/resource/machine.rb in clc-fork-chef-metal-0.14.alpha.3 vs lib/chef/resource/machine.rb in clc-fork-chef-metal-0.14.alpha.4

- old
+ new

@@ -1,11 +1,14 @@ require 'chef/resource/lwrp_base' require 'cheffish' require 'chef_metal' require 'cheffish/merged_config' -class Chef::Resource::Machine < Chef::Resource::LWRPBase +class Chef +class Resource +class Machine < Chef::Resource::LWRPBase + self.resource_name = 'machine' def initialize(*args) super @chef_environment = run_context.cheffish.current_environment @@ -17,12 +20,14 @@ actions :allocate, :ready, :setup, :converge, :converge_only, :destroy, :stop default_action :converge # Driver attributes attribute :driver - attribute :machine_options + # Machine options + attribute :machine_options + # Node attributes Cheffish.node_attributes(self) # Client keys # Options to generate private key (size, type, etc.) when the server doesn't have it @@ -90,10 +95,30 @@ def add_machine_options(options) @machine_options = Cheffish::MergedConfig.new(options, @machine_options) end + + # This is here because metal users will probably want to do things like: + # machine "foo" + # action :destroy + # end + # + # @example + # with_machine_options :bootstrap_options => { ... } + # machine "foo" + # converge true + # end + # + # Without this, the first resource's machine options will obliterate the second + # resource's machine options, and then unexpected (and undesired) things happen. + def load_prior_resource + Chef::Log.debug "Overloading #{self.resource_name} load_prior_resource with NOOP" + end + # chef client version and omnibus # chef-zero boot method? # chef-client -z boot method? # pushy boot method? end +end +end \ No newline at end of file