diff options
author | Seth Chisamore <schisamo@opscode.com> | 2012-11-13 14:05:57 -0500 |
---|---|---|
committer | Seth Chisamore <schisamo@opscode.com> | 2012-11-13 17:27:31 -0500 |
commit | 6317bf5f07f70b8ec70ad254a5b8b3aca9b6bbe7 (patch) | |
tree | c6c5f52d1a46e9dc0c0ea4846bb030db6a59c4eb /lib/chef/provider/service | |
parent | ea28e343db64d9dbee57707e81e19342c2493365 (diff) | |
download | chef-6317bf5f07f70b8ec70ad254a5b8b3aca9b6bbe7.tar.gz |
[CHEF-3603] add init_command attribute to service resource
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r-- | lib/chef/provider/service/init.rb | 14 | ||||
-rw-r--r-- | lib/chef/provider/service/simple.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/solaris.rb | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb index ab843d764d..2dd03679c5 100644 --- a/lib/chef/provider/service/init.rb +++ b/lib/chef/provider/service/init.rb @@ -37,9 +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?(@init_command) } - a.failure_message(Chef::Exceptions::Service, "#{@init_command} does not exist!") - a.whyrun("Init script '#{@init_command}' doesn't exist, assuming a prior action would have created it.") do + a.assertion { ::File.exist?(default_init_command) } + 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: @status_load_success = false end @@ -50,7 +50,7 @@ class Chef if @new_resource.start_command super else - shell_out!("#{@init_command} start") + shell_out!("#{default_init_command} start") end end @@ -58,7 +58,7 @@ class Chef if @new_resource.stop_command super else - shell_out!("#{@init_command} stop") + shell_out!("#{default_init_command} stop") end end @@ -66,7 +66,7 @@ class Chef if @new_resource.restart_command super elsif @new_resource.supports[:restart] - shell_out!("#{@init_command} restart") + shell_out!("#{default_init_command} restart") else stop_service sleep 1 @@ -78,7 +78,7 @@ class Chef if @new_resource.reload_command super elsif @new_resource.supports[:reload] - shell_out!("#{@init_command} reload") + shell_out!("#{default_init_command} reload") end end end diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb index 670c62d480..bcb85230d0 100644 --- a/lib/chef/provider/service/simple.rb +++ b/lib/chef/provider/service/simple.rb @@ -128,7 +128,7 @@ class Chef elsif @new_resource.supports[:status] Chef::Log.debug("#{@new_resource} supports status, running") begin - if shell_out("#{@init_command} status").exitstatus == 0 + if shell_out("#{default_init_command} status").exitstatus == 0 @current_resource.running true Chef::Log.debug("#{@new_resource} is running") end diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb index 8e131590e8..364b6f6542 100644 --- a/lib/chef/provider/service/solaris.rb +++ b/lib/chef/provider/service/solaris.rb @@ -42,12 +42,12 @@ class Chef end def enable_service - run_command(:command => "#{@init_command} enable #{@new_resource.service_name}") + run_command(:command => "#{default_init_command} enable #{@new_resource.service_name}") return service_status.enabled end def disable_service - run_command(:command => "#{@init_command} disable #{@new_resource.service_name}") + run_command(:command => "#{default_init_command} disable #{@new_resource.service_name}") return service_status.enabled end @@ -55,7 +55,7 @@ class Chef alias_method :start_service, :enable_service def reload_service - run_command(:command => "#{@init_command} refresh #{@new_resource.service_name}") + run_command(:command => "#{default_init_command} refresh #{@new_resource.service_name}") end def restart_service |