action :restart do
service service_name do
action :restart
+ only_if { service_exists? }
end
end
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