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

Allow s3 sources for download uris #368

Merged
merged 1 commit into from
Sep 19, 2019
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 manifests/alertmanager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
Stdlib::Absolutepath $config_dir,
Stdlib::Absolutepath $config_file,
String $download_extension,
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Array $extra_groups,
Hash $global,
String $group,
Expand Down
38 changes: 19 additions & 19 deletions manifests/apache_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -78,31 +78,31 @@
class prometheus::apache_exporter (
String[1] $scrape_uri,
String[1] $download_extension,
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Array[String[1]] $extra_groups,
String[1] $group,
String[1] $package_ensure,
String[1] $package_name,
String[1] $user,
String[1] $version,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String[1] $service_ensure = 'running',
String[1] $init_style = $prometheus::init_style,
String[1] $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String[1] $os = $prometheus::os,
String $extra_options = '',
Optional[Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl]] $download_url = undef,
String[1] $config_mode = $prometheus::config_mode,
String[1] $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9117,
String[1] $scrape_job_name = 'apache',
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String[1] $service_ensure = 'running',
String[1] $init_style = $prometheus::init_style,
String[1] $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String[1] $os = $prometheus::os,
String $extra_options = '',
Optional[Prometheus::Uri] $download_url = undef,
String[1] $config_mode = $prometheus::config_mode,
String[1] $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9117,
String[1] $scrape_job_name = 'apache',
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down
2 changes: 1 addition & 1 deletion manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#
define prometheus::daemon (
String $version,
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl] $real_download_url,
Prometheus::Uri $real_download_url,
$notify_service,
String $user,
String $group,
Expand Down
2 changes: 1 addition & 1 deletion manifests/haproxy_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
String $package_name,
String $user,
String $version,
Stdlib::HTTPUrl $download_url_base,
Prometheus::Uri $download_url_base,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
Stdlib::Absolutepath $shared_dir,
String $version,
String $install_method,
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $download_url_base,
Prometheus::Uri $download_url_base,
String $download_extension,
String $package_name,
String $package_ensure,
Expand Down
40 changes: 20 additions & 20 deletions manifests/mysqld_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -97,32 +97,32 @@
Stdlib::Port $cnf_port,
String $cnf_user,
String $download_extension,
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Array $extra_groups,
String $group,
String $package_ensure,
String $package_name,
String $user,
String $version,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String $service_ensure = 'running',
String $init_style = $prometheus::init_style,
String $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String $os = $prometheus::os,
String $extra_options = '',
Optional[Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl]] $download_url = undef,
String $config_mode = $prometheus::config_mode,
Optional[Stdlib::Absolutepath] $cnf_socket = undef,
String $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9104,
String[1] $scrape_job_name = 'mysql',
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String $service_ensure = 'running',
String $init_style = $prometheus::init_style,
String $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String $os = $prometheus::os,
String $extra_options = '',
Optional[Prometheus::Uri] $download_url = undef,
String $config_mode = $prometheus::config_mode,
Optional[Stdlib::Absolutepath] $cnf_socket = undef,
String $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9104,
String[1] $scrape_job_name = 'mysql',
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down
40 changes: 20 additions & 20 deletions manifests/process_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,33 @@

class prometheus::process_exporter(
String $download_extension,
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Array $extra_groups,
String $group,
String $package_ensure,
String $package_name,
String $user,
String $version,
Stdlib::Absolutepath $config_path,
Array $watched_processes = [],
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String $service_ensure = 'running',
String $init_style = $prometheus::init_style,
String $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String $os = $prometheus::os,
String $extra_options = '',
String $config_mode = $prometheus::config_mode,
Optional[Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl]] $download_url = undef,
String $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9256,
String[1] $scrape_job_name = 'process',
Array $watched_processes = [],
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String $service_ensure = 'running',
String $init_style = $prometheus::init_style,
String $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String $os = $prometheus::os,
String $extra_options = '',
String $config_mode = $prometheus::config_mode,
Optional[Prometheus::Uri] $download_url = undef,
String $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9256,
String[1] $scrape_job_name = 'process',
) inherits prometheus {

$filename = "${package_name}-${version}.${os}-${arch}.${download_extension}"
Expand Down
2 changes: 1 addition & 1 deletion manifests/pushprox_client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
class prometheus::pushprox_client (
String[1] $proxy_url,
String $download_extension,
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Array[String[1]] $extra_groups,
String $group,
String $package_ensure,
Expand Down
2 changes: 1 addition & 1 deletion manifests/pushprox_proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# The binary release version
class prometheus::pushprox_proxy (
String $download_extension,
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Array[String[1]] $extra_groups,
String $group,
String $package_ensure,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Stdlib::Absolutepath $shared_dir = $prometheus::shared_dir,
String $version = $prometheus::version,
String $install_method = $prometheus::install_method,
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $download_url_base = $prometheus::download_url_base,
Prometheus::Uri $download_url_base = $prometheus::download_url_base,
String $download_extension = $prometheus::download_extension,
String $package_name = $prometheus::package_name,
String $package_ensure = $prometheus::package_ensure,
Expand Down
38 changes: 19 additions & 19 deletions manifests/statsd_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

class prometheus::statsd_exporter (
String $download_extension,
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Array $extra_groups,
String $group,
Stdlib::Absolutepath $mapping_config_path,
Expand All @@ -91,24 +91,24 @@
Array[Hash] $mappings,
String $user,
String $version,
String $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
String $config_mode = $prometheus::config_mode,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String $service_ensure = 'running',
String $os = $prometheus::os,
String $init_style = $prometheus::init_style,
String $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String $extra_options = '',
Optional[Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl]] $download_url = undef,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9102,
String[1] $scrape_job_name = 'statsd',
String $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
String $config_mode = $prometheus::config_mode,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String $service_ensure = 'running',
String $os = $prometheus::os,
String $init_style = $prometheus::init_style,
String $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String $extra_options = '',
Optional[Prometheus::Uri] $download_url = undef,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9102,
String[1] $scrape_job_name = 'statsd',
) inherits prometheus {

# Prometheus added a 'v' on the realease name at 0.4.0 and changed the configuration format to yaml in 0.5.0
Expand Down
2 changes: 1 addition & 1 deletion manifests/varnish_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
String $package_name,
String $user,
String $version,
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $download_url_base,
Prometheus::Uri $download_url_base,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Expand Down
30 changes: 30 additions & 0 deletions spec/type_aliases/s3uri_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'spec_helper'

describe 'Prometheus::S3Uri' do
describe 'accepts case-sensitive amazon web services s3 uris' do
[
's3://bucket-name/path',
's3://bucket/path/to/file.txt'
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end

describe 'rejects other values' do
[
'',
'S3://bucket-name/path',
3,
's3:/bucket-name/path',
's3//bucket-name/path',
's3:bucket-name/path',
's3-bucket-name/path'
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
33 changes: 33 additions & 0 deletions spec/type_aliases/uri_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'spec_helper'

describe 'Prometheus::Uri' do
describe 'accepts http, https, and case-sensitive aws s3 uris' do
[
'http://www.download.com',
'HTTP://www.download.com',
'Https://service.io',
'https://service.io',
's3://bucket-name/path',
's3://bucket/path/to/file.txt'
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end

describe 'rejects other values' do
[
'',
'htpt://www.download.com',
'httds://service.io',
'S3://bucket-name/path',
3,
's3-bucket-name/path'
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
1 change: 1 addition & 0 deletions types/s3uri.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Prometheus::S3Uri = Pattern[/^s3:\/\//]
5 changes: 5 additions & 0 deletions types/uri.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type Prometheus::Uri = Variant[
Stdlib::HTTPUrl,
Stdlib::HTTPSUrl,
Prometheus::S3Uri,
]