]> git.openstreetmap.org Git - chef.git/commitdiff
Add brackets around IPv6 addresses
authorTom Hughes <tom@compton.nu>
Wed, 16 Sep 2020 16:54:38 +0000 (17:54 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 16 Sep 2020 16:55:20 +0000 (17:55 +0100)
cookbooks/prometheus/resources/exporter.rb
cookbooks/prometheus/templates/default/prometheus.yml.erb

index c75248f99f559311a123b92c5e11eeaba3d5e693..08c0e03b749a4f83e44f8c503be246652352dfa9 100644 (file)
@@ -77,7 +77,11 @@ action_class do
   end
 
   def listen_address
-    "#{node[:prometheus][:address]}:#{new_resource.port}"
+    if node[:prometheus][:mode] == "wireguard"
+      "[#{node[:prometheus][:address]}]:#{new_resource.port}"
+    else
+      "#{node[:prometheus][:address]}:#{new_resource.port}"
+    end
   end
 
   def service_name
index 66051b622dfc9098919246c7a3c2d6e758f11f03..46d241905d46fd17b22d72870a64d9439135168e 100644 (file)
@@ -16,7 +16,7 @@ scrape_configs:
     static_configs:
 <% targets.each do |target| -%>
       - targets:
-          - <%= target[:address] %>
+          - "<%= target[:address] %>"
         labels:
           instance: <%= target[:name].split(".").first %>
 <% end -%>