diff options
author | John Keiser <john@johnkeiser.com> | 2015-07-28 14:38:10 -0600 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-07-31 12:42:28 -0600 |
commit | 0db1f4f0ee0c5ad5bf7146723195a7f80644194f (patch) | |
tree | a4185f35d664438bdfcf102770ceabb2364ec9e9 /lib/chef/resource.rb | |
parent | 221e63a2de6414ae1d4422753589dccf7d35c351 (diff) | |
download | chef-0db1f4f0ee0c5ad5bf7146723195a7f80644194f.tar.gz |
Add Resource.action.converged_if_changed
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r-- | lib/chef/resource.rb | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index bb5c6050fe..b6355dab55 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -1,7 +1,8 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Author:: Christopher Walters (<cw@opscode.com>) -# Copyright:: Copyright (c) 2008 Opscode, Inc. +# Author:: John Keiser (<jkeiser@chef.io) +# Copyright:: Copyright (c) 2008-2015 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,6 +28,7 @@ require 'chef/mixin/convert_to_class_name' require 'chef/guard_interpreter/resource_guard_interpreter' require 'chef/resource/conditional' require 'chef/resource/conditional_action_not_nothing' +require 'chef/resource/action_provider' require 'chef/resource_collection' require 'chef/node_map' require 'chef/node' @@ -1439,35 +1441,13 @@ class Chef resource_class = self @action_provider_class = Class.new(base_provider) do - use_inline_resources - include_resource_dsl true + include ActionProvider define_singleton_method(:to_s) { "#{resource_class} action provider" } def self.inspect to_s end - def load_current_resource - if new_resource.respond_to?(:load_current_value!) - # dup the resource and then reset desired-state properties. - current_resource = new_resource.dup - - # We clear desired state in the copy, because it is supposed to be actual state. - # We keep identity properties and non-desired-state, which are assumed to be - # "control" values like `recurse: true` - current_resource.class.properties.each do |name,property| - if property.desired_state? && !property.identity? && !property.name_property? - property.reset(current_resource) - end - end - - if current_resource.method(:load_current_value!).arity > 0 - current_resource.load_current_value!(new_resource) - else - current_resource.load_current_value! - end - end - @current_resource = current_resource - end end + @action_provider_class end # |