Skip to content
Open
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
12 changes: 12 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
file { $::grafana::cfg_location:
ensure => present,
content => template('grafana/config.ini.erb'),
owner => 'root',
group => 'grafana',
mode => '0440',
}
}
}
Expand All @@ -20,6 +23,9 @@
file { $::grafana::cfg_location:
ensure => present,
content => template('grafana/config.ini.erb'),
owner => 'root',
group => 'grafana',
mode => '0440',
}
}
'archive': {
Expand All @@ -28,6 +34,9 @@
file { "${::grafana::install_dir}/conf/custom.ini":
ensure => present,
content => template('grafana/config.ini.erb'),
owner => 'root',
group => 'grafana',
mode => '0440',
}
}
default: {
Expand All @@ -40,6 +49,9 @@
file { '/etc/grafana/ldap.toml':
ensure => present,
content => inline_template("<%= require 'toml'; TOML::Generator.new(@ldap_cfg).body %>\n"),
owner => 'root',
group => 'grafana',
mode => '0440',
}
}
}
14 changes: 14 additions & 0 deletions spec/classes/grafana_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@
describe 'should not contain any configuration when cfg param is empty' do
it { should contain_file('/etc/grafana/grafana.ini').with_content("# This file is managed by Puppet, any changes will be overwritten\n\n") }
end
describe 'should have the correct ownership and permissions for config file' do
it { should contain_file('/etc/grafana/grafana.ini').with(
:owner => 'root',
:group => 'grafana',
:mode => '0440',
)}
end

describe 'should correctly transform cfg param entries to Grafana configuration' do
let(:params) {{
Expand Down Expand Up @@ -303,6 +310,13 @@
"\n"

it { should contain_file('/etc/grafana/ldap.toml').with_content(ldap_expected) }
describe 'should have the correct ownership and permissions for ldap file' do
it { should contain_file('/etc/grafana/ldap.toml').with(
:owner => 'root',
:group => 'grafana',
:mode => '0440',
)}
end
end
end
end