lib/itamae/resource/service.rb in itamae-1.1.13 vs lib/itamae/resource/service.rb in itamae-1.1.14
- old
+ new
@@ -23,14 +23,18 @@
current.running = run_specinfra(:check_service_is_running, attributes.name)
current.enabled = run_specinfra(:check_service_is_enabled, attributes.name)
end
def action_start(options)
- run_specinfra(:start_service, attributes.name)
+ unless current.running
+ run_specinfra(:start_service, attributes.name)
+ end
end
def action_stop(options)
- run_specinfra(:stop_service, attributes.name)
+ if current.running
+ run_specinfra(:stop_service, attributes.name)
+ end
end
def action_restart(options)
run_specinfra(:restart_service, attributes.name)
end