diff options
-rw-r--r-- | lib/chef/provider/service/upstart.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/service/upstart_service_spec.rb | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 268324b8c7..4acad768a4 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -190,9 +190,9 @@ class Chef # http://upstart.ubuntu.com/cookbook/#restart (it doesn't uses latest jon config from disk but retains old) else if @current_resource.running - stop_command + stop_service sleep 1 - start_command + start_service else start_service end diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb index fd9ea0573c..0692bdb64a 100644 --- a/spec/unit/provider/service/upstart_service_spec.rb +++ b/spec/unit/provider/service/upstart_service_spec.rb @@ -295,9 +295,11 @@ describe Chef::Provider::Service::Upstart do @provider.restart_service() end - it "should call '/sbin/restart service_name' if no restart command is specified" do + it "should call start/sleep/stop if no restart command is specified" do allow(@current_resource).to receive(:running).and_return(true) - expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/restart #{@new_resource.service_name}").and_return(shell_out_success) + expect(@provider).to receive(:stop_service) + expect(@provider).to receive(:sleep).with(1) + expect(@provider).to receive(:start_service) @provider.restart_service() end |