Filippo Giunchedi has submitted this change and it was merged.

Change subject: prometheus: use ordered_yaml for server config
......................................................................


prometheus: use ordered_yaml for server config

Avoid occasional shuffle of prometheus server configuration, causing a reload.

Change-Id: I1319a562282b8e925e4ab97156dca88292d83917
---
M modules/prometheus/manifests/server.pp
D modules/prometheus/templates/prometheus.yml.erb
2 files changed, 7 insertions(+), 8 deletions(-)

Approvals:
  Filippo Giunchedi: Verified; Looks good to me, approved



diff --git a/modules/prometheus/manifests/server.pp 
b/modules/prometheus/manifests/server.pp
index b03f842..7fe5a5c 100644
--- a/modules/prometheus/manifests/server.pp
+++ b/modules/prometheus/manifests/server.pp
@@ -93,6 +93,12 @@
     ]
     $rule_files = concat($rule_files_default, $rule_files_extra)
 
+    $prometheus_config = {
+      'global'         => $global_config,
+      'rule_files'     => $rule_files,
+      'scrape_configs' => $scrape_configs,
+    }
+
     file { "${rules_path}/alerts_default.conf":
         ensure  => file,
         mode    => '0444',
@@ -108,7 +114,7 @@
         owner   => 'root',
         group   => 'root',
         notify  => Exec["${service_name}-reload"],
-        content => template('prometheus/prometheus.yml.erb'),
+        content => ordered_yaml($prometheus_config),
     }
 
     file { [$base_path, $metrics_path, $targets_path, $rules_path]:
diff --git a/modules/prometheus/templates/prometheus.yml.erb 
b/modules/prometheus/templates/prometheus.yml.erb
deleted file mode 100644
index b6538d9..0000000
--- a/modules/prometheus/templates/prometheus.yml.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-<%=
-  require 'yaml'
-  { 'global'         => @global_config,
-    'rule_files'     => @rule_files,
-    'scrape_configs' => @scrape_configs
-  }.to_yaml
-%>

-- 
To view, visit https://gerrit.wikimedia.org/r/296550
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1319a562282b8e925e4ab97156dca88292d83917
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to