diff options
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/provider/service.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/init.rb | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb index 27af1ac970..fbf269dbec 100644 --- a/lib/chef/provider/service.rb +++ b/lib/chef/provider/service.rb @@ -163,6 +163,10 @@ class Chef end end + def custom_command_for_action?(action) + !!@new_resource.send("#{action}_command".to_sym) rescue false + end + end end end diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb index 2dd03679c5..09f47e866f 100644 --- a/lib/chef/provider/service/init.rb +++ b/lib/chef/provider/service/init.rb @@ -37,7 +37,9 @@ class Chef # do not call super here, inherit only shared_requirements shared_resource_requirements requirements.assert(:start, :stop, :restart, :reload) do |a| - a.assertion { ::File.exist?(default_init_command) } + a.assertion do + custom_command_for_action?(action) || ::File.exist?(default_init_command) + end a.failure_message(Chef::Exceptions::Service, "#{default_init_command} does not exist!") a.whyrun("Init script '#{default_init_command}' doesn't exist, assuming a prior action would have created it.") do # blindly assume that the service exists but is stopped in why run mode: |