diff options
author | Bryan McLellan <btm@opscode.com> | 2011-06-01 15:43:26 -0700 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2011-06-01 15:43:26 -0700 |
commit | bd3be775f37e822916be65634e4478730f196d43 (patch) | |
tree | 58cc6949d3937af0edf704f27ad7a17727f75322 | |
parent | 8e964515c6c036f513c557ae8c8b3fed9a33aa24 (diff) | |
download | chef-bd3be775f37e822916be65634e4478730f196d43.tar.gz |
CHEF-1424: Upstart always supports restart
-rw-r--r-- | chef/lib/chef/provider/service/upstart.rb | 8 | ||||
-rw-r--r-- | chef/spec/unit/provider/service/upstart_service_spec.rb | 8 |
2 files changed, 3 insertions, 13 deletions
diff --git a/chef/lib/chef/provider/service/upstart.rb b/chef/lib/chef/provider/service/upstart.rb index a32d67fc9a..9969c99521 100644 --- a/chef/lib/chef/provider/service/upstart.rb +++ b/chef/lib/chef/provider/service/upstart.rb @@ -140,16 +140,14 @@ class Chef def restart_service if @new_resource.restart_command super - elsif @new_resource.supports[:restart] + # Upstart always provides restart functionality so we don't need to mimic it with stop/sleep/start. + # Older versions of upstart would fail on restart if the service was currently stopped, check for that. LP:430883 + else @new_resource.supports[:restart] if @current_resource.running run_command_with_systems_locale(:command => "/sbin/restart #{@new_resource.service_name}") else start_service end - else - stop_service - sleep(1) - start_service end end diff --git a/chef/spec/unit/provider/service/upstart_service_spec.rb b/chef/spec/unit/provider/service/upstart_service_spec.rb index 88b47e6263..82e8c58e49 100644 --- a/chef/spec/unit/provider/service/upstart_service_spec.rb +++ b/chef/spec/unit/provider/service/upstart_service_spec.rb @@ -206,7 +206,6 @@ describe Chef::Provider::Service::Upstart do describe "start and stop service" do before(:each) do - @new_resource.supports(:restart => true) @current_resource = Chef::Resource::Service.new('rsyslog') Chef::Resource::Service.stub!(:new).and_return(@current_resource) @@ -249,13 +248,6 @@ describe Chef::Provider::Service::Upstart do @provider.restart_service() end - it "should start & stop the service if @new_resource.supports[:restart] == false" do - @new_resource.supports(:restart => false) - @provider.should_receive(:stop_service).and_return(true) - @provider.should_receive(:start_service).and_return(true) - @provider.restart_service() - end - it "should call the reload command if one is specified" do @current_resource.stub!(:running).and_return(true) @new_resource.stub!(:reload_command).and_return("/sbin/rsyslog reloadyousillysally") |