diff --git a/manifests/init.pp b/manifests/init.pp index 524c0650d..e712c722e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -139,7 +139,7 @@ $shared_dir = $::prometheus::params::shared_dir, $arch = $::prometheus::params::arch, $version = $::prometheus::params::version, - $install_method = $::prometheus::params::install_method, + $install_method = $::prometheus::params::prometheus_install_method, $os = $::prometheus::params::os, $download_url = undef, $download_url_base = $::prometheus::params::download_url_base, diff --git a/manifests/params.pp b/manifests/params.pp index bc6308480..7af18acce 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -20,7 +20,6 @@ $alertmanager_user = 'alertmanager' $alertmanager_version = '0.5.1' $alerts = {} - $bin_dir = '/usr/local/bin' $config_dir = '/etc/prometheus' $config_mode = '0660' $config_template = 'prometheus/prometheus.yaml.erb' @@ -205,7 +204,6 @@ $redis_exporter_user = 'redis-exporter' $redis_exporter_version = '0.11.2' $user = 'prometheus' - $version = '1.5.2' case $::architecture { 'x86_64', 'amd64': { $arch = 'amd64' } 'i386': { $arch = '386' } @@ -217,6 +215,9 @@ $os = downcase($::kernel) if $::operatingsystem == 'Ubuntu' { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = '/etc/default' if versioncmp($::operatingsystemrelease, '8.04') < 1 { $init_style = 'debian' @@ -226,6 +227,9 @@ $init_style = 'systemd' } } elsif $::operatingsystem =~ /Scientific|CentOS|RedHat|OracleLinux/ { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = '/etc/sysconfig' if versioncmp($::operatingsystemrelease, '7.0') < 0 { $init_style = 'sysv' @@ -233,6 +237,9 @@ $init_style = 'systemd' } } elsif $::operatingsystem == 'Fedora' { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = '/etc/sysconfig' if versioncmp($::operatingsystemrelease, '12') < 0 { $init_style = 'sysv' @@ -240,6 +247,9 @@ $init_style = 'systemd' } } elsif $::operatingsystem == 'Debian' { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = '/etc/default' if versioncmp($::operatingsystemrelease, '8.0') < 0 { $init_style = 'debian' @@ -247,12 +257,21 @@ $init_style = 'systemd' } } elsif $::operatingsystem == 'Archlinux' { + $version = '2.2.0' + $bin_dir = '/usr/bin' + $prometheus_install_method = 'package' $env_file_path = '/etc/default' $init_style = 'systemd' } elsif $::operatingsystem == 'OpenSuSE' { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = '/etc/sysconfig' $init_style = 'systemd' } elsif $::operatingsystem =~ /SLE[SD]/ { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = '/etc/sysconfig' if versioncmp($::operatingsystemrelease, '12.0') < 0 { $init_style = 'sles' @@ -260,12 +279,21 @@ $init_style = 'systemd' } } elsif $::operatingsystem == 'Darwin' { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = undef $init_style = 'launchd' } elsif $::operatingsystem == 'Amazon' { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $env_file_path = '/etc/sysconfig' $init_style = 'sysv' } else { + $version = '1.5.2' + $bin_dir = '/usr/local/bin' + $prometheus_install_method = 'url' $init_style = undef } if $init_style == undef { diff --git a/metadata.json b/metadata.json index dec0f4eb9..ab2b7c019 100644 --- a/metadata.json +++ b/metadata.json @@ -49,6 +49,9 @@ "6", "7" ] + }, + { + "operatingsystem": "Archlinux" } ], "requirements": [ diff --git a/spec/classes/alertmanager_spec.rb b/spec/classes/alertmanager_spec.rb index 56ca6691b..2076e547a 100644 --- a/spec/classes/alertmanager_spec.rb +++ b/spec/classes/alertmanager_spec.rb @@ -12,7 +12,8 @@ { version: '0.9.1', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/beanstalkd_exporter_spec.rb b/spec/classes/beanstalkd_exporter_spec.rb index 17b92458d..591c77972 100644 --- a/spec/classes/beanstalkd_exporter_spec.rb +++ b/spec/classes/beanstalkd_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '1.0.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/blackbox_exporter_spec.rb b/spec/classes/blackbox_exporter_spec.rb index dd9c6b701..aabe786d9 100644 --- a/spec/classes/blackbox_exporter_spec.rb +++ b/spec/classes/blackbox_exporter_spec.rb @@ -13,6 +13,7 @@ version: '0.6.0', arch: 'amd64', os: 'linux', + bin_dir: '/usr/local/bin', modules: { 'http_2xx' => { 'prober' => 'http' diff --git a/spec/classes/consul_exporter_spec.rb b/spec/classes/consul_exporter_spec.rb index 3c4a88e0c..92161374a 100644 --- a/spec/classes/consul_exporter_spec.rb +++ b/spec/classes/consul_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.3.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/elasticsearch_exporter_spec.rb b/spec/classes/elasticsearch_exporter_spec.rb index 31e0dad1f..520a64ace 100644 --- a/spec/classes/elasticsearch_exporter_spec.rb +++ b/spec/classes/elasticsearch_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '1.0.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/haproxy_exporter_spec.rb b/spec/classes/haproxy_exporter_spec.rb index e9bbddbad..051ce9d2e 100644 --- a/spec/classes/haproxy_exporter_spec.rb +++ b/spec/classes/haproxy_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.7.1', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/mongodb_exporter_spec.rb b/spec/classes/mongodb_exporter_spec.rb index 83dcdca4c..4abc1098a 100644 --- a/spec/classes/mongodb_exporter_spec.rb +++ b/spec/classes/mongodb_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.3.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/nginx_vts_exporter_spec.rb b/spec/classes/nginx_vts_exporter_spec.rb index 09478f517..7cec68198 100644 --- a/spec/classes/nginx_vts_exporter_spec.rb +++ b/spec/classes/nginx_vts_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.6', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/node_exporter_spec.rb b/spec/classes/node_exporter_spec.rb index aac716921..618164a2f 100644 --- a/spec/classes/node_exporter_spec.rb +++ b/spec/classes/node_exporter_spec.rb @@ -39,7 +39,8 @@ { version: '0.13.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/prometheus_spec.rb b/spec/classes/prometheus_spec.rb index 87f18d790..55ef905db 100644 --- a/spec/classes/prometheus_spec.rb +++ b/spec/classes/prometheus_spec.rb @@ -7,7 +7,7 @@ facts end - [{}, { version: '2.0.0-rc.1' }].each do |parameters| + [{ version: '2.0.0-rc.1', bin_dir: '/usr/local/bin', install_method: 'url' }].each do |parameters| context "with parameters #{parameters}" do let(:params) do parameters @@ -116,7 +116,7 @@ 'content' => File.read(fixtures('files', "prometheus#{prom_major}.sysv")) ) } - elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64'].include?(os) + elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64', 'archlinux-4-x86_64'].include?(os) # init_style = 'systemd' it { is_expected.to contain_class('systemd') } @@ -149,7 +149,7 @@ } else it { - is_expected.to raise_error(Puppet::Error, %r{I don.t know how to create an init script for style}) + is_expected.to raise_error(Puppet::Error, %r{I don't know how to create an init script for style}) } end @@ -203,6 +203,7 @@ context 'with alerts configured', alerts: true do [ { + version: '1.5.3', alerts: [{ 'name' => 'alert_name', 'condition' => 'up == 0', @@ -236,7 +237,7 @@ parameters end - prom_version = parameters[:version] || '1.5.2' + prom_version = parameters[:version] prom_major = prom_version[0] it { diff --git a/spec/classes/pushgateway_spec.rb b/spec/classes/pushgateway_spec.rb index 05eb24319..ef7dd69f9 100644 --- a/spec/classes/pushgateway_spec.rb +++ b/spec/classes/pushgateway_spec.rb @@ -12,7 +12,8 @@ { version: '0.4.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/rabbitmq_exporter_spec.rb b/spec/classes/rabbitmq_exporter_spec.rb index baec28d22..4aeef756d 100644 --- a/spec/classes/rabbitmq_exporter_spec.rb +++ b/spec/classes/rabbitmq_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '1.0.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/redis_exporter_spec.rb b/spec/classes/redis_exporter_spec.rb index 593673800..93be13b5b 100644 --- a/spec/classes/redis_exporter_spec.rb +++ b/spec/classes/redis_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.11.2', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/snmp_exporter_spec.rb b/spec/classes/snmp_exporter_spec.rb index a64c08533..da10b25fd 100644 --- a/spec/classes/snmp_exporter_spec.rb +++ b/spec/classes/snmp_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.6.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/defines/alerts_spec.rb b/spec/defines/alerts_spec.rb index 781032ead..6abbb4185 100644 --- a/spec/defines/alerts_spec.rb +++ b/spec/defines/alerts_spec.rb @@ -17,6 +17,7 @@ [ { + version: '1.5.2', alerts: [ { 'name' => 'alert_name', @@ -62,7 +63,7 @@ parameters end - prom_version = parameters[:version] || '1.5.2' + prom_version = parameters[:version] prom_major = prom_version[0] it { diff --git a/spec/defines/daemon_spec.rb b/spec/defines/daemon_spec.rb index 6b85d2b1b..6d76d2995 100644 --- a/spec/defines/daemon_spec.rb +++ b/spec/defines/daemon_spec.rb @@ -22,7 +22,8 @@ notify_service: 'Service[smurf_exporter]', user: 'smurf_user', group: 'smurf_group', - env_vars: { SOMEVAR: 42 } + env_vars: { SOMEVAR: 42 }, + bin_dir: '/usr/local/bin' } ].each do |parameters| context "with parameters #{parameters}" do @@ -30,6 +31,7 @@ parameters end + it { is_expected.to contain_class('prometheus::params') } prom_os = facts[:kernel].downcase prom_arch = facts[:architecture] == 'i386' ? '386' : 'amd64' @@ -102,7 +104,7 @@ %r{daemon --user=smurf_user \\\n --pidfile="\$PID_FILE" \\\n "\$DAEMON" '' >> "\$LOG_FILE" &} ) } - elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64'].include?(os) + elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64', 'archlinux-4-x86_64'].include?(os) # init_style = 'systemd' it { is_expected.to contain_class('systemd') } @@ -142,7 +144,7 @@ } else it { - is_expected.to raise_error(Puppet::Error, %r{I don.t know how to create an init script for style}) + is_expected.to raise_error(Puppet::Error, %r{I don't know how to create an init script for style}) } end