Skip to content

Commit 5237b77

Browse files
committed
Extend puppet type check for install_method
previously we had a case statement that checked for 3 values in a string. We now uplift those 3 values into an enum to make validation better and easier to test.
1 parent 6b0843f commit 5237b77

27 files changed

+289
-56
lines changed

REFERENCE.md

+257-26
Large diffs are not rendered by default.

manifests/apache_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
Stdlib::Ensure::Service $service_ensure = 'running',
6666
String[1] $service_name = 'apache_exporter',
6767
Prometheus::Initstyle $init_style = $facts['service_provider'],
68-
String[1] $install_method = $prometheus::install_method,
68+
Prometheus::Install $install_method = $prometheus::install_method,
6969
Boolean $manage_group = true,
7070
Boolean $manage_service = true,
7171
Boolean $manage_user = true,

manifests/beanstalkd_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
Boolean $service_enable = true,
7373
Stdlib::Ensure::Service $service_ensure = 'running',
7474
Prometheus::Initstyle $init_style = $facts['service_provider'],
75-
String[1] $install_method = $prometheus::install_method,
75+
Prometheus::Install $install_method = $prometheus::install_method,
7676
Boolean $manage_group = true,
7777
Boolean $manage_service = true,
7878
Boolean $manage_user = true,

manifests/bird_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
Stdlib::Ensure::Service $service_ensure = 'running',
6868
String[1] $service_name = 'bird_exporter',
6969
Prometheus::Initstyle $init_style = $facts['service_provider'],
70-
String[1] $install_method = 'url',
70+
Prometheus::Install $install_method = 'url',
7171
Boolean $manage_group = true,
7272
Boolean $manage_service = true,
7373
Boolean $manage_user = true,

manifests/blackbox_exporter.pp

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
# User which runs the service
4848
# @param version
4949
# The binary release version
50+
# @param config_mode
51+
# The permissions of the configuration files
5052
# Example for configuring named blackbox modules via hiera
5153
# details of the format: https://github.com/prometheus/blackbox_exporter/blob/master/CONFIGURATION.md
5254
# @example
@@ -75,7 +77,7 @@
7577
Stdlib::Ensure::Service $service_ensure = 'running',
7678
String[1] $service_name = 'blackbox_exporter',
7779
Prometheus::Initstyle $init_style = $facts['service_provider'],
78-
String[1] $install_method = $prometheus::install_method,
80+
Prometheus::Install $install_method = $prometheus::install_method,
7981
Boolean $manage_group = true,
8082
Boolean $manage_service = true,
8183
Boolean $manage_user = true,

manifests/collectd_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
String $options,
5656
String[1] $os = downcase($facts['kernel']),
5757
Prometheus::Initstyle $init_style = $facts['service_provider'],
58-
String[1] $install_method = $prometheus::install_method,
58+
Prometheus::Install $install_method = $prometheus::install_method,
5959
Optional[String[1]] $download_url = undef,
6060
String[1] $arch = $prometheus::real_arch,
6161
String[1] $bin_dir = $prometheus::bin_dir,

manifests/consul_exporter.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
Boolean $manage_user = true,
8080
String[1] $os = downcase($facts['kernel']),
8181
Prometheus::Initstyle $init_style = $facts['service_provider'],
82-
String[1] $install_method = $prometheus::install_method,
82+
Prometheus::Install $install_method = $prometheus::install_method,
8383
String $extra_options = '',
8484
Optional[String] $download_url = undef,
8585
String[1] $arch = $prometheus::real_arch,
86-
String[1] $bin_dir = $prometheus::bin_dir,
86+
String[1] $bin_dir = $prometheus::bin_dir,
8787
Boolean $export_scrape_job = false,
8888
Optional[Stdlib::Host] $scrape_host = undef,
8989
Stdlib::Port $scrape_port = 9107,

manifests/daemon.pp

+3-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
$notify_service,
5252
String[1] $user,
5353
String[1] $group,
54-
String[1] $install_method = $prometheus::install_method,
54+
Prometheus::Install $install_method = $prometheus::install_method,
5555
String $download_extension = $prometheus::download_extension,
5656
String[1] $os = $prometheus::os,
5757
String[1] $arch = $prometheus::real_arch,
@@ -72,7 +72,7 @@
7272
Optional[String] $env_file_path = $prometheus::env_file_path,
7373
Optional[String[1]] $extract_command = $prometheus::extract_command,
7474
Stdlib::Absolutepath $extract_path = '/opt',
75-
Stdlib::Absolutepath $archive_bin_path = "/opt/${name}-${version}.${os}-${arch}/${name}",
75+
Stdlib::Absolutepath $archive_bin_path = "/opt/${name}-${version}.${os}-${arch}/${name}",
7676
Boolean $export_scrape_job = false,
7777
Stdlib::Host $scrape_host = $facts['networking']['fqdn'],
7878
Optional[Stdlib::Port] $scrape_port = undef,
@@ -129,9 +129,7 @@
129129
}
130130
}
131131
'none': {}
132-
default: {
133-
fail("The provided install method ${install_method} is invalid")
134-
}
132+
default: {}
135133
}
136134
if $manage_user {
137135
# if we manage the service, we need to reload it if our user changes

manifests/dellhw_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
Stdlib::Ensure::Service $service_ensure = 'running',
6565
String[1] $service_name = 'dellhw_exporter',
6666
Prometheus::Initstyle $init_style = $facts['service_provider'],
67-
String[1] $install_method = $prometheus::install_method,
67+
Prometheus::Install $install_method = $prometheus::install_method,
6868
Boolean $manage_group = true,
6969
Boolean $manage_service = true,
7070
Boolean $manage_user = true,

manifests/elasticsearch_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
Boolean $service_enable = true,
7070
Stdlib::Ensure::Service $service_ensure = 'running',
7171
Prometheus::Initstyle $init_style = $facts['service_provider'],
72-
String[1] $install_method = $prometheus::install_method,
72+
Prometheus::Install $install_method = $prometheus::install_method,
7373
Boolean $manage_group = true,
7474
Boolean $manage_service = true,
7575
Boolean $manage_user = true,

manifests/graphite_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
String $options,
5656
String[1] $os = downcase($facts['kernel']),
5757
Prometheus::Initstyle $init_style = $facts['service_provider'],
58-
String[1] $install_method = $prometheus::install_method,
58+
Prometheus::Install $install_method = $prometheus::install_method,
5959
Optional[String] $download_url = undef,
6060
String[1] $arch = $prometheus::real_arch,
6161
String[1] $bin_dir = $prometheus::bin_dir,

manifests/grok_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
Stdlib::Ensure::Service $service_ensure = 'running',
7070
String[1] $service_name = 'grok_exporter',
7171
Prometheus::Initstyle $init_style = $facts['service_provider'],
72-
String[1] $install_method = $prometheus::install_method,
72+
Prometheus::Install $install_method = $prometheus::install_method,
7373
Boolean $manage_group = true,
7474
Boolean $manage_service = true,
7575
Boolean $manage_user = true,

manifests/haproxy_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
Boolean $service_enable = true,
6464
Stdlib::Ensure::Service $service_ensure = 'running',
6565
Prometheus::Initstyle $init_style = $facts['service_provider'],
66-
String[1] $install_method = $prometheus::install_method,
66+
Prometheus::Install $install_method = $prometheus::install_method,
6767
Boolean $manage_group = true,
6868
Boolean $manage_service = true,
6969
Boolean $manage_user = true,

manifests/memcached_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
Stdlib::Ensure::Service $service_ensure = 'running',
6161
String[1] $service_name = 'memcached_exporter',
6262
Prometheus::Initstyle $init_style = $facts['service_provider'],
63-
String[1] $install_method = $prometheus::install_method,
63+
Prometheus::Install $install_method = $prometheus::install_method,
6464
Boolean $manage_group = true,
6565
Boolean $manage_service = true,
6666
Boolean $manage_user = true,

manifests/mesos_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
Boolean $service_enable = true,
6767
Stdlib::Ensure::Service $service_ensure = 'running',
6868
Prometheus::Initstyle $init_style = $facts['service_provider'],
69-
String[1] $install_method = $prometheus::install_method,
69+
Prometheus::Install $install_method = $prometheus::install_method,
7070
Boolean $manage_group = true,
7171
Boolean $manage_service = true,
7272
Boolean $manage_user = true,

manifests/mongodb_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
Boolean $service_enable = true,
6969
Stdlib::Ensure::Service $service_ensure = 'running',
7070
Prometheus::Initstyle $init_style = $facts['service_provider'],
71-
String[1] $install_method = $prometheus::install_method,
71+
Prometheus::Install $install_method = $prometheus::install_method,
7272
Boolean $manage_group = true,
7373
Boolean $manage_service = true,
7474
Boolean $manage_user = true,

manifests/mysqld_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
Boolean $service_enable = true,
8282
Stdlib::Ensure::Service $service_ensure = 'running',
8383
Prometheus::Initstyle $init_style = $facts['service_provider'],
84-
String[1] $install_method = $prometheus::install_method,
84+
Prometheus::Install $install_method = $prometheus::install_method,
8585
Boolean $manage_group = true,
8686
Boolean $manage_service = true,
8787
Boolean $manage_user = true,

manifests/node_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
Stdlib::Ensure::Service $service_ensure = 'running',
7070
String[1] $service_name = 'node_exporter',
7171
Prometheus::Initstyle $init_style = $facts['service_provider'],
72-
String[1] $install_method = $prometheus::install_method,
72+
Prometheus::Install $install_method = $prometheus::install_method,
7373
Boolean $manage_group = true,
7474
Boolean $manage_service = true,
7575
Boolean $manage_user = true,

manifests/postgres_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
Stdlib::Ensure::Service $service_ensure = 'running',
7474
String[1] $service_name = 'postgres_exporter',
7575
Prometheus::Initstyle $init_style = $facts['service_provider'],
76-
String[1] $install_method = $prometheus::install_method,
76+
Prometheus::Install $install_method = $prometheus::install_method,
7777
Boolean $manage_group = true,
7878
Boolean $manage_service = true,
7979
Boolean $manage_user = true,

manifests/process_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
Boolean $service_enable = true,
8989
Stdlib::Ensure::Service $service_ensure = 'running',
9090
Prometheus::Initstyle $init_style = $facts['service_provider'],
91-
String[1] $install_method = $prometheus::install_method,
91+
Prometheus::Install $install_method = $prometheus::install_method,
9292
Boolean $manage_group = true,
9393
Boolean $manage_service = true,
9494
Boolean $manage_user = true,

manifests/puppetdb_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
Stdlib::Ensure::Service $service_ensure = 'running',
6363
String[1] $service_name = 'puppetdb_exporter',
6464
Prometheus::Initstyle $init_style = $facts['service_provider'],
65-
String[1] $install_method = $prometheus::install_method,
65+
Prometheus::Install $install_method = $prometheus::install_method,
6666
Boolean $manage_group = true,
6767
Boolean $manage_service = true,
6868
Boolean $manage_user = true,

manifests/rabbitmq_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
Optional[String] $download_url = undef,
8787
String $extra_options = '',
8888
Prometheus::Initstyle $init_style = $facts['service_provider'],
89-
String[1] $install_method = $prometheus::install_method,
89+
Prometheus::Install $install_method = $prometheus::install_method,
9090
Boolean $manage_group = true,
9191
Boolean $manage_service = true,
9292
Boolean $manage_user = true,

manifests/redis_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
Stdlib::Ensure::Service $service_ensure = 'running',
6868
String[1] $service_name = 'redis_exporter',
6969
Prometheus::Initstyle $init_style = $facts['service_provider'],
70-
String[1] $install_method = $prometheus::install_method,
70+
Prometheus::Install $install_method = $prometheus::install_method,
7171
Boolean $manage_group = true,
7272
Boolean $manage_service = true,
7373
Boolean $manage_user = true,

manifests/snmp_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
Boolean $service_enable = true,
6969
Stdlib::Ensure::Service $service_ensure = 'running',
7070
Prometheus::Initstyle $init_style = $facts['service_provider'],
71-
String[1] $install_method = $prometheus::install_method,
71+
Prometheus::Install $install_method = $prometheus::install_method,
7272
Boolean $manage_group = true,
7373
Boolean $manage_service = true,
7474
Boolean $manage_user = true,

manifests/statsd_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
Stdlib::Ensure::Service $service_ensure = 'running',
7676
String[1] $os = downcase($facts['kernel']),
7777
Prometheus::Initstyle $init_style = $facts['service_provider'],
78-
String[1] $install_method = $prometheus::install_method,
78+
Prometheus::Install $install_method = $prometheus::install_method,
7979
Boolean $manage_group = true,
8080
Boolean $manage_service = true,
8181
Boolean $manage_user = true,

manifests/varnish_exporter.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
Boolean $service_enable = true,
6161
Stdlib::Ensure::Service $service_ensure = 'running',
6262
Prometheus::Initstyle $init_style = $facts['service_provider'],
63-
String[1] $install_method = $prometheus::install_method,
63+
Prometheus::Install $install_method = $prometheus::install_method,
6464
Boolean $manage_group = true,
6565
Boolean $manage_service = true,
6666
Boolean $manage_user = true,

types/install.pp

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# @summary type to enforce the different installation methods for our exporters.
2+
type Prometheus::Install = Enum['url', 'package', 'none']

0 commit comments

Comments
 (0)