Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop suport for redis_exporter < 1.0.0 #732

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10958,7 +10958,7 @@ Data type: `Stdlib::Port`



Default value: `9090`
Default value: `9419`

##### <a name="-prometheus--rabbitmq_exporter--scrape_job_name"></a>`scrape_job_name`

Expand Down
39 changes: 1 addition & 38 deletions manifests/redis_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
26 changes: 0 additions & 26 deletions spec/acceptance/redis_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions spec/classes/redis_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
Loading