Skip to content

Commit

Permalink
remove code options for elasticsearch_exporter < 1.1.0
Browse files Browse the repository at this point in the history
fixes #786
  • Loading branch information
TheMeier committed Sep 4, 2024
1 parent 83dd7fa commit b7ab86b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
1 change: 0 additions & 1 deletion data/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ prometheus::elasticsearch_exporter::package_ensure: 'latest'
prometheus::elasticsearch_exporter::package_name: 'elasticsearch_exporter'
prometheus::elasticsearch_exporter::service_name: 'elasticsearch_exporter'
prometheus::elasticsearch_exporter::user: 'elasticsearch-exporter'
prometheus::elasticsearch_exporter::use_kingpin: true
prometheus::mesos_exporter::server_type: 'master'
prometheus::mesos_exporter::cnf_scrape_uri: 'http://localhost:5050'
prometheus::mesos_exporter::download_extension: 'tar.gz'
Expand Down
17 changes: 3 additions & 14 deletions manifests/elasticsearch_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@
# User which runs the service
# @param version
# The binary release version
# @param use_kingpin
# Since version 1.1.0, the elasticsearch exporter uses kingpin, thus
# this param to define how we call the es.uri and es.timeout in the $options
# https://github.com/prometheus-community/elasticsearch_exporter/blob/v1.1.0/CHANGELOG.md
# @param proxy_server
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
Expand All @@ -82,7 +78,6 @@
String[1] $package_name,
String[1] $service_name,
String[1] $user,
Boolean $use_kingpin,
# renovate: depName=prometheus-community/elasticsearch_exporter
String[1] $version = '1.7.0',
Boolean $purge_config_dir = true,
Expand All @@ -109,19 +104,13 @@
Stdlib::Absolutepath $web_config_file = '/etc/elasticsearch_exporter_web-config.yml',
Prometheus::Web_config $web_config_content = {},
) inherits prometheus {
#Please provide the download_url for versions < 0.9.0
$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")

$notify_service = $restart_on_change ? {
true => Service[$service_name],
default => undef,
}

$flag_prefix = $use_kingpin ? {
true => '--',
false => '-',
}

$_web_config_ensure = $web_config_content.empty ? {
true => absent,
default => file,
Expand All @@ -139,12 +128,12 @@
$_web_config = if $web_config_content.empty {
''
} else {
"${flag_prefix}web.config.file=${$web_config_file}"
"--web.config.file=${$web_config_file}"
}

$options = [
"${flag_prefix}es.uri=${cnf_uri}",
"${flag_prefix}es.timeout=${cnf_timeout}",
"--es.uri=${cnf_uri}",
"--es.timeout=${cnf_timeout}",
$extra_options,
$_web_config,
].filter |$x| { !$x.empty }.join(' ')
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/elasticsearch_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: '1.0.0',
version: '1.7.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin',
Expand All @@ -25,7 +25,7 @@
end

describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/elasticsearch_exporter').with('target' => '/opt/elasticsearch_exporter-1.0.0.linux-amd64/elasticsearch_exporter') }
it { is_expected.to contain_file('/usr/local/bin/elasticsearch_exporter').with('target' => '/opt/elasticsearch_exporter-1.7.0.linux-amd64/elasticsearch_exporter') }
end

context 'with tls set in web-config.yml' do
Expand Down

0 comments on commit b7ab86b

Please sign in to comment.