Skip to content

Commit

Permalink
fix owner and groupship of dbconfig files on debian, extend unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Jan 13, 2020
1 parent 6d0d07e commit 0f6948c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion manifests/feature/idomysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,12 @@
# install additional package
if $ido_mysql_package_name and $manage_package {
if $::osfamily == 'debian' {
ensure_resources('file', { '/etc/dbconfig-common' => { ensure => directory } })
ensure_resources('file', { '/etc/dbconfig-common' => { ensure => directory, owner => 'root', group => 'root' } })
file { "/etc/dbconfig-common/${ido_mysql_package_name}.conf":
ensure => file,
content => "dbc_install='false'\ndbc_upgrade='false'\ndbc_remove='false'\n",
owner => 'root',
group => 'root',
mode => '0600',
before => Package[$ido_mysql_package_name],
}
Expand Down
4 changes: 3 additions & 1 deletion manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@
# install additional package
if $ido_pgsql_package_name and $manage_package {
if $::osfamily == 'debian' {
ensure_resources('file', { '/etc/dbconfig-common' => { ensure => directory } })
ensure_resources('file', { '/etc/dbconfig-common' => { ensure => directory, owner => 'root', group => 'root' } })
file { "/etc/dbconfig-common/${ido_pgsql_package_name}.conf":
ensure => file,
content => "dbc_install='false'\ndbc_upgrade='false'\ndbc_remove='false'\n",
owner => 'root',
group => 'root',
mode => '0600',
before => Package[$ido_pgsql_package_name],
}
Expand Down
9 changes: 9 additions & 0 deletions spec/classes/idomysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@
it { is_expected.to contain_package('icinga2-ido-mysql').with({ 'ensure' => 'installed' }) }
end

if facts[:osfamily] == 'Debian'
it { is_expected.to contain_file('/etc/dbconfig-common/icinga2-ido-mysql.conf')
.with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root', })
}
end

it { is_expected.to contain_icinga2__feature('ido-mysql').with({'ensure' => 'present'}) }

it { is_expected.to contain_icinga2__object('icinga2::object::IdoMysqlConnection::ido-mysql')
Expand Down
9 changes: 9 additions & 0 deletions spec/classes/idopgsql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
it { is_expected.to contain_package('icinga2-ido-pgsql').with({ 'ensure' => 'installed' }) }
end

if facts[:osfamily] == 'Debian'
it { is_expected.to contain_file('/etc/dbconfig-common/icinga2-ido-pgsql.conf')
.with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root', })
}
end

it { is_expected.to contain_icinga2__feature('ido-pgsql').with({'ensure' => 'present'}) }

it { is_expected.to contain_concat__fragment('icinga2::object::IdoPgsqlConnection::ido-pgsql')
Expand Down

0 comments on commit 0f6948c

Please sign in to comment.