diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-11-24 11:36:15 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-11-24 11:36:15 -0800 |
commit | ba7e3b5e95252583fd06c93683b02c73efedd6f0 (patch) | |
tree | 9a563a68bbdbd273d09068ec1ab58b674514ab9b /lib/chef | |
parent | 54dc8d4ebde11e14f5142a56a2653172597c3956 (diff) | |
download | chef-ba7e3b5e95252583fd06c93683b02c73efedd6f0.tar.gz |
add better documentation to this method
it violates our dont-violate-the-new-resource policy for a reason, but
is likely still buggy if the resource gets reused.
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/provider/service.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb index e7bb2a76d7..d72d135b09 100644 --- a/lib/chef/provider/service.rb +++ b/lib/chef/provider/service.rb @@ -44,16 +44,19 @@ class Chef supports[:restart] = false if supports[:restart].nil? end - def load_new_resource_state - # If the user didn't specify a change in enabled state, - # it will be the same as the old resource - if ( @new_resource.enabled.nil? ) - @new_resource.enabled(@current_resource.enabled) - end - if ( @new_resource.running.nil? ) - @new_resource.running(@current_resource.running) - end - end + # the new_resource#enabled and #running variables are not user input, but when we + # do (e.g.) action_enable we want to set new_resource.enabled so that the comparison + # between desired and current state produces the correct change in reporting. + # XXX?: the #nil? check below will likely fail if this is a cloned resource or if + # we just run multiple actions. + def load_new_resource_state + if ( @new_resource.enabled.nil? ) + @new_resource.enabled(@current_resource.enabled) + end + if ( @new_resource.running.nil? ) + @new_resource.running(@current_resource.running) + end + end def shared_resource_requirements end |