diff --git a/manifests/haproxy_exporter.pp b/manifests/haproxy_exporter.pp index da532a617..66eb9befe 100644 --- a/manifests/haproxy_exporter.pp +++ b/manifests/haproxy_exporter.pp @@ -73,7 +73,7 @@ # The binary release version class prometheus::haproxy_exporter( - Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $cnf_scrape_uri, + Variant[Stdlib::HTTPUrl, Pattern[/unix:(?:\/.+)+/]] $cnf_scrape_uri, String $download_extension, Array $extra_groups, String $group, diff --git a/spec/classes/haproxy_exporter_spec.rb b/spec/classes/haproxy_exporter_spec.rb index a9e69cb68..8806ef9e8 100644 --- a/spec/classes/haproxy_exporter_spec.rb +++ b/spec/classes/haproxy_exporter_spec.rb @@ -26,6 +26,24 @@ it { is_expected.to contain_group('haproxy-exporter') } it { is_expected.to contain_prometheus__daemon('haproxy_exporter') } end + + context 'with unix socket as scraping url' do + let(:params) do + { + cnf_scrape_uri: 'unix:/var/haproxy/listen.sock', + arch: 'amd64', + os: 'linux', + bin_dir: '/usr/local/bin', + install_method: 'url' + } + end + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('prometheus') } + it { is_expected.to contain_user('haproxy-user') } + it { is_expected.to contain_group('haproxy-exporter') } + it { is_expected.to contain_prometheus__daemon('haproxy_exporter') } + end end end end