From b34c9f1031040b2b9509ec4efe7d8a68e4637ed5 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 14:20:00 -0400 Subject: [PATCH 01/12] move -log.format into prometheus < v2 log options --- manifests/config.pp | 1 + templates/prometheus.sysv.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 2d3a9e31d..07ee57498 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -15,6 +15,7 @@ fail('remote_write_configs requires prometheus 2.X') } $daemon_flags = [ + "-log.format logger:stdout", "-config.file=${prometheus::server::config_dir}/${prometheus::server::configname}", "-storage.local.path=${prometheus::server::localstorage}", "-storage.local.retention=${prometheus::server::storage_retention}", diff --git a/templates/prometheus.sysv.erb b/templates/prometheus.sysv.erb index 1a3573908..e5ec3498d 100644 --- a/templates/prometheus.sysv.erb +++ b/templates/prometheus.sysv.erb @@ -51,7 +51,7 @@ start() { [ -f $PID_FILE ] && rm $PID_FILE daemon --user=<%= scope.lookupvar('prometheus::server::user') %> \ --pidfile="$PID_FILE" \ - "$DAEMON" -log.format logger:stdout <%= @daemon_flags.join(" \\\n ") %> \ + "$DAEMON" <%= @daemon_flags.join(" \\\n ") %> \ <%= scope.lookupvar('prometheus::server::extra_options') %> >> "$LOG_FILE" & retcode=$? mkpidfile From 069c63d5b77b043978812b4d0bc72b7dd85ae557 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 16:57:34 -0400 Subject: [PATCH 02/12] check for 'redhat' service_provider and use sysv if so. support armv6l arch with armv6 packages --- manifests/config.pp | 4 ++++ manifests/init.pp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/manifests/config.pp b/manifests/config.pp index 07ee57498..3ef014a6b 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -4,6 +4,10 @@ assert_private() + if $prometheus::server::init_style = 'redhat' { + $prometheus::server::init_style = 'sysv' + } + if $prometheus::server::init_style { if( versioncmp($prometheus::server::version, '2.0.0') < 0 ){ # helper variable indicating prometheus version, so we can use on this information in the template diff --git a/manifests/init.pp b/manifests/init.pp index f70281ca5..ed3c70901 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -182,7 +182,12 @@ Optional[Variant[Stdlib::HTTPUrl, Stdlib::Unixpath, String[1]]] $external_url = undef, ) { + $real_arch = $arch case $arch { + # 'armv5': {} + 'armv6l': { $real_arch = 'armv6' } + # 'armv7': {} + # 'armv64': {} 'x86_64', 'amd64': { $real_arch = 'amd64' } 'i386': { $real_arch = '386' } 'armv7l': { $real_arch = 'armv7' } From 024b7771699688207b250347451b12358c325b84 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 17:02:30 -0400 Subject: [PATCH 03/12] cleanup arch --- manifests/init.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index ed3c70901..b186da9c7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -134,7 +134,7 @@ # # Requires: see Modulefile # -# Sample Usage: +# Sample Usage: # class prometheus ( String $configname, @@ -182,12 +182,9 @@ Optional[Variant[Stdlib::HTTPUrl, Stdlib::Unixpath, String[1]]] $external_url = undef, ) { - $real_arch = $arch case $arch { - # 'armv5': {} + # 'armv5', "armv7" { $real_arch = $arch } 'armv6l': { $real_arch = 'armv6' } - # 'armv7': {} - # 'armv64': {} 'x86_64', 'amd64': { $real_arch = 'amd64' } 'i386': { $real_arch = '386' } 'armv7l': { $real_arch = 'armv7' } From 6cab35171129c81747998aea982ebdbb84b4db93 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 17:06:14 -0400 Subject: [PATCH 04/12] fix == --- manifests/config.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 3ef014a6b..a32f0185c 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -4,7 +4,7 @@ assert_private() - if $prometheus::server::init_style = 'redhat' { + if $prometheus::server::init_style == 'redhat' { $prometheus::server::init_style = 'sysv' } From 9cf89eee60da51a296b1ebbd80701c10cd72f378 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 17:06:43 -0400 Subject: [PATCH 05/12] 'redhat' init style --- manifests/config.pp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index a32f0185c..2aad73f0a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -4,10 +4,6 @@ assert_private() - if $prometheus::server::init_style == 'redhat' { - $prometheus::server::init_style = 'sysv' - } - if $prometheus::server::init_style { if( versioncmp($prometheus::server::version, '2.0.0') < 0 ){ # helper variable indicating prometheus version, so we can use on this information in the template @@ -76,7 +72,7 @@ content => template('prometheus/prometheus.systemd.erb'), } } - 'sysv' : { + 'sysv', 'redhat' : { file { '/etc/init.d/prometheus': mode => '0555', owner => 'root', From 9ab0fbe2925ffc6f2e05de7028e07fc4d2d20257 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 17:08:28 -0400 Subject: [PATCH 06/12] redhat init_style --- manifests/service_reload.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/service_reload.pp b/manifests/service_reload.pp index b42078428..a604dcafa 100644 --- a/manifests/service_reload.pp +++ b/manifests/service_reload.pp @@ -10,6 +10,7 @@ 'systemd' => "systemctl reload-or-restart ${init_selector}", 'upstart' => "service ${init_selector} reload", 'sysv' => "/etc/init.d/${init_selector} reload", + 'redhat' => "/etc/init.d/${init_selector} reload", 'sles' => "/etc/init.d/${init_selector} reload", 'debian' => "/etc/init.d/${init_selector} reload", 'launchd' => "launchctl stop ${init_selector} && launchctl start ${init_selector}", From 670e50fbf985f70ffb6ecb4cc4117e1f3eec454c Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 17:39:00 -0400 Subject: [PATCH 07/12] armv7 --- manifests/init.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index b186da9c7..c42f00fa2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -183,8 +183,9 @@ ) { case $arch { - # 'armv5', "armv7" { $real_arch = $arch } + # 'armv5', 'armv6l': { $real_arch = 'armv6' } + "armv7l" { $real_arch = 'armv7' } 'x86_64', 'amd64': { $real_arch = 'amd64' } 'i386': { $real_arch = '386' } 'armv7l': { $real_arch = 'armv7' } From 5c7bba3152cedbd65ae1579fc648628d3a6acd98 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 14 Oct 2018 22:33:43 -0400 Subject: [PATCH 08/12] fix colon --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index c42f00fa2..6ec308b6c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -185,7 +185,7 @@ case $arch { # 'armv5', 'armv6l': { $real_arch = 'armv6' } - "armv7l" { $real_arch = 'armv7' } + 'armv7l': { $real_arch = 'armv7' } 'x86_64', 'amd64': { $real_arch = 'amd64' } 'i386': { $real_arch = '386' } 'armv7l': { $real_arch = 'armv7' } From 2ab1977eedb533138e094464ffd98121b7c44ba4 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 21 Oct 2018 22:56:13 -0400 Subject: [PATCH 09/12] single quote line without variables for travis --- manifests/config.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 2aad73f0a..4ad1cfd5f 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -15,7 +15,7 @@ fail('remote_write_configs requires prometheus 2.X') } $daemon_flags = [ - "-log.format logger:stdout", + '-log.format logger:stdout', "-config.file=${prometheus::server::config_dir}/${prometheus::server::configname}", "-storage.local.path=${prometheus::server::localstorage}", "-storage.local.retention=${prometheus::server::storage_retention}", From a1a1d82ca8f760a572b6391c40911c0f63c79e89 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Sun, 21 Oct 2018 22:58:53 -0400 Subject: [PATCH 10/12] remove space --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 6ec308b6c..913fa3059 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -134,7 +134,7 @@ # # Requires: see Modulefile # -# Sample Usage: +# Sample Usage: # class prometheus ( String $configname, From fbf8f37f31d023b5d01a538751f349c127ee2181 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Mon, 4 Feb 2019 15:46:29 -0500 Subject: [PATCH 11/12] correct spec file test --- spec/fixtures/files/prometheus2.sysv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/fixtures/files/prometheus2.sysv b/spec/fixtures/files/prometheus2.sysv index 32c0dda4f..46cde890f 100644 --- a/spec/fixtures/files/prometheus2.sysv +++ b/spec/fixtures/files/prometheus2.sysv @@ -51,7 +51,7 @@ start() { [ -f $PID_FILE ] && rm $PID_FILE daemon --user=prometheus \ --pidfile="$PID_FILE" \ - "$DAEMON" -log.format logger:stdout --config.file=/etc/prometheus/prometheus.yaml \ + "$DAEMON" --config.file=/etc/prometheus/prometheus.yaml \ --storage.tsdb.path=/var/lib/prometheus \ --storage.tsdb.retention=360h \ --web.console.templates=/usr/local/share/prometheus/consoles \ From 0cc1d74e21b03b6f26cba427689b769ea1235aa2 Mon Sep 17 00:00:00 2001 From: Alan Brevick Date: Mon, 4 Feb 2019 16:29:37 -0500 Subject: [PATCH 12/12] indentation --- manifests/service_reload.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/service_reload.pp b/manifests/service_reload.pp index a604dcafa..65c3ef5d4 100644 --- a/manifests/service_reload.pp +++ b/manifests/service_reload.pp @@ -10,7 +10,7 @@ 'systemd' => "systemctl reload-or-restart ${init_selector}", 'upstart' => "service ${init_selector} reload", 'sysv' => "/etc/init.d/${init_selector} reload", - 'redhat' => "/etc/init.d/${init_selector} reload", + 'redhat' => "/etc/init.d/${init_selector} reload", 'sles' => "/etc/init.d/${init_selector} reload", 'debian' => "/etc/init.d/${init_selector} reload", 'launchd' => "launchctl stop ${init_selector} && launchctl start ${init_selector}",