X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/26fb67a986550cb2c88da938d98d7e8bcbc0822c..cd3653225c75a743806ae73b473eda8a2a93724e:/cookbooks/prometheus/resources/exporter.rb diff --git a/cookbooks/prometheus/resources/exporter.rb b/cookbooks/prometheus/resources/exporter.rb index df5304b3c..ae0596885 100644 --- a/cookbooks/prometheus/resources/exporter.rb +++ b/cookbooks/prometheus/resources/exporter.rb @@ -85,6 +85,7 @@ end action :restart do service service_name do action :restart + only_if { service_exists? } end end @@ -97,6 +98,10 @@ action_class do end end + def service_exists? + File.exist?("/etc/systemd/system/#{service_name}.service") + end + def executable_path "/opt/prometheus/exporters/#{new_resource.exporter}/#{new_resource.exporter}_exporter" end