From 02ee2ad730dcc74017bd9bb7f2014e4188cf20a8 Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Wed, 4 Sep 2024 14:07:55 +0200 Subject: [PATCH] remove code options for elasticsearch_exporter < 1.1.0 fixes #786 --- REFERENCE.md | 9 --------- data/defaults.yaml | 1 - manifests/elasticsearch_exporter.pp | 17 +++-------------- spec/classes/elasticsearch_exporter_spec.rb | 4 ++-- 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index d49f8177..c5cfafe5 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -3818,7 +3818,6 @@ The following parameters are available in the `prometheus::elasticsearch_exporte * [`service_name`](#-prometheus--elasticsearch_exporter--service_name) * [`user`](#-prometheus--elasticsearch_exporter--user) * [`version`](#-prometheus--elasticsearch_exporter--version) -* [`use_kingpin`](#-prometheus--elasticsearch_exporter--use_kingpin) * [`proxy_server`](#-prometheus--elasticsearch_exporter--proxy_server) * [`proxy_type`](#-prometheus--elasticsearch_exporter--proxy_type) * [`web_config_file`](#-prometheus--elasticsearch_exporter--web_config_file) @@ -4044,14 +4043,6 @@ The binary release version Default value: `'1.7.0'` -##### `use_kingpin` - -Data type: `Boolean` - -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 - ##### `proxy_server` Data type: `Optional[String[1]]` diff --git a/data/defaults.yaml b/data/defaults.yaml index c8f05d52..d8bc4504 100644 --- a/data/defaults.yaml +++ b/data/defaults.yaml @@ -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' diff --git a/manifests/elasticsearch_exporter.pp b/manifests/elasticsearch_exporter.pp index 8a2bb357..19d7469a 100644 --- a/manifests/elasticsearch_exporter.pp +++ b/manifests/elasticsearch_exporter.pp @@ -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 @@ -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, @@ -109,7 +104,6 @@ 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 ? { @@ -117,11 +111,6 @@ default => undef, } - $flag_prefix = $use_kingpin ? { - true => '--', - false => '-', - } - $_web_config_ensure = $web_config_content.empty ? { true => absent, default => file, @@ -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(' ') diff --git a/spec/classes/elasticsearch_exporter_spec.rb b/spec/classes/elasticsearch_exporter_spec.rb index e68f8aea..0ef43ba4 100644 --- a/spec/classes/elasticsearch_exporter_spec.rb +++ b/spec/classes/elasticsearch_exporter_spec.rb @@ -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', @@ -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