lib/chef/provider/service/upstart.rb in chef-0.10.2 vs lib/chef/provider/service/upstart.rb in chef-0.10.4.rc.1
- old
+ new
@@ -138,11 +138,17 @@
end
def restart_service
if @new_resource.restart_command
super
- else
- run_command_with_systems_locale(:command => "/sbin/restart #{@new_resource.service_name}")
+ # 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
end
end
def reload_service
if @new_resource.reload_command