Skip to content

Commit

Permalink
Parameterize the node exporter promfile directory owner
Browse files Browse the repository at this point in the history
Puppetserver needs puppet to own this directory.
  • Loading branch information
daaang committed Aug 7, 2024
1 parent e188178 commit d62c04f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion manifests/profile/prometheus/exporter/node.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Optional[String] $version = undef,
Array $covered_datacenters = [],
String $default_datacenter = 'default',
String $promfile_owner = 'prometheus',
) {
$log_file = '/var/log/prometheus-node-exporter.log'

Expand Down Expand Up @@ -90,7 +91,7 @@
file { '/var/lib/prometheus/node-exporter':
ensure => 'directory',
mode => '2775',
owner => 'prometheus',
owner => $promfile_owner,
group => 'prometheus',
}

Expand Down
7 changes: 7 additions & 0 deletions spec/classes/profile/prometheus/exporter/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@
.that_requires('File[/var/lib/prometheus]')
end

context 'with promfile_owner set to brlglph' do
let(:params) { { promfile_owner: 'brlglph' } }

it { is_expected.to contain_file('/var/lib/prometheus/node-exporter').with_owner('brlglph') }
it { is_expected.to contain_file('/var/lib/prometheus/node-exporter').with_group('prometheus') }
end

it do
is_expected.to contain_file('/var/lib/prometheus')
.with_ensure('directory')
Expand Down

0 comments on commit d62c04f

Please sign in to comment.