+
+ def listen_argument
+ case new_resource.listen_type
+ when "address" then listen_address
+ when "url" then "http://#{listen_address}/metrics"
+ end
+ end
+
+ def listen_address
+ if new_resource.address
+ "#{new_resource.address}:#{new_resource.port}"
+ elsif node[:prometheus][:mode] == "wireguard"
+ "[#{node[:prometheus][:address]}]:#{new_resource.port}"
+ else
+ "#{node[:prometheus][:address]}:#{new_resource.port}"
+ end
+ end
+end
+
+def after_created
+ subscribes :restart, "git[/opt/prometheus-exporters]"