diff --git a/REFERENCE.md b/REFERENCE.md index 575d0ef4e..cdc0bdbb5 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -10958,7 +10958,7 @@ Data type: `Stdlib::Port` -Default value: `9090` +Default value: `9419` ##### `scrape_job_name` diff --git a/manifests/redis_exporter.pp b/manifests/redis_exporter.pp index 2ad967f16..face663f2 100644 --- a/manifests/redis_exporter.pp +++ b/manifests/redis_exporter.pp @@ -100,45 +100,8 @@ $str_addresses = join($addr, ',') $options = "-redis.addr=${str_addresses} -namespace=${namespace} ${extra_options}" - if $install_method == 'url' { - if versioncmp($version, '1.0.0') >= 0 { - # From version 1.0.0 the tarball format changed to be consistent with most other exporters - $real_install_method = $install_method - } else { - # Not a big fan of copypasting but prometheus::daemon takes for granted - # a specific path embedded in the prometheus *_exporter tarball, which - # redis_exporter lacks before version 1.0.0 - # TODO: patch prometheus::daemon to support custom extract directories - $real_install_method = 'none' - $install_dir = "/opt/${service_name}-${version}.${os}-${arch}" - file { $install_dir: - ensure => 'directory', - owner => 'root', - group => 0, # 0 instead of root because OS X uses "wheel". - mode => '0555', - } - -> archive { "/tmp/${service_name}-${version}.${download_extension}": - ensure => present, - extract => true, - extract_path => $install_dir, - source => $real_download_url, - checksum_verify => false, - creates => "${install_dir}/${service_name}", - cleanup => true, - } - -> file { "${bin_dir}/${service_name}": - ensure => link, - notify => $notify_service, - target => "${install_dir}/${service_name}", - before => Prometheus::Daemon[$service_name], - } - } - } else { - $real_install_method = $install_method - } - prometheus::daemon { $service_name: - install_method => $real_install_method, + install_method => $install_method, version => $release, download_extension => $download_extension, os => $os, diff --git a/spec/acceptance/redis_exporter_spec.rb b/spec/acceptance/redis_exporter_spec.rb index eb7562e71..7d6ac05b4 100644 --- a/spec/acceptance/redis_exporter_spec.rb +++ b/spec/acceptance/redis_exporter_spec.rb @@ -28,30 +28,4 @@ end end end - - context 'with version 0.11.2 (default version in module version < 8.0.0)' do - it 'redis_exporter works idempotently with no errors' do - pp = 'class { "prometheus::redis_exporter": version => "0.11.2" }' - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - describe service('redis_exporter') do - it { is_expected.to be_running } - it { is_expected.to be_enabled } - end - # the class installs an the redis_exporter that listens on port 9121 - - describe port(9121) do - it { is_expected.to be_listening.with('tcp6') } - end - - it 'is version v0.11.2' do - shell('curl -s http://127.0.0.1:9121/metrics') do |r| - redis_exporter_build_info = r.stdout.split(%r{\n}).find { |line| line =~ %r{^redis_exporter_build_info} } - expect(redis_exporter_build_info).to match(%r{,version="v0\.11\.2"}) - end - end - end end diff --git a/spec/classes/redis_exporter_spec.rb b/spec/classes/redis_exporter_spec.rb index b83ce3934..addd1634a 100644 --- a/spec/classes/redis_exporter_spec.rb +++ b/spec/classes/redis_exporter_spec.rb @@ -12,7 +12,7 @@ context 'with version specified' do let(:params) do { - version: '0.11.2', + version: '1.9.0', arch: 'amd64', os: 'linux', bin_dir: '/usr/local/bin', @@ -23,9 +23,8 @@ it { is_expected.to compile.with_all_deps } describe 'install correct binary' do - it { is_expected.to contain_file('/usr/local/bin/redis_exporter').with('target' => '/opt/redis_exporter-0.11.2.linux-amd64/redis_exporter') } - it { is_expected.to contain_file('/opt/redis_exporter-0.11.2.linux-amd64') } - it { is_expected.to contain_archive('/tmp/redis_exporter-0.11.2.tar.gz') } + it { is_expected.to contain_file('/usr/local/bin/redis_exporter').with('target' => '/opt/redis_exporter-v1.9.0.linux-amd64/redis_exporter') } + it { is_expected.to contain_archive('/tmp/redis_exporter-v1.9.0.tar.gz') } end describe 'required resources' do