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
6 changes: 4 additions & 2 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@
if $includedir == undef or $includedir == '' or
($configparentdir != $includedir and $configparentdir != dirname($includedir)) {
file { $configparentdir:
ensure => directory,
mode => '0755',
ensure => directory,
mode => '0755',
recurse => $mysql::server::purge_conf_dir,
purge => $mysql::server::purge_conf_dir,
}
}
}
Expand Down
24 changes: 20 additions & 4 deletions spec/classes/mycnf_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,27 @@
end

context 'with includedir' do
let(:params) { { includedir: '/etc/my.cnf.d' } }
let(:params) {{ includedir: '/etc/my.cnf.d' } }

it 'makes the directory' do
expect(subject).to contain_file('/etc/my.cnf.d').with(ensure: :directory,
mode: '0755')
context 'when purge_conf_dir is false' do
let(:params) { super().merge({'purge_conf_dir' => false })}

it 'makes the directory without recursion' do
expect(subject).to contain_file('/etc/my.cnf.d').with(ensure: :directory,
mode: '0755',
recurse: false,
purge: false)
end
end

context 'when purge_conf_dir is true' do
let(:params) { super().merge({'purge_conf_dir' => true })}

it 'makes the directory with purge and recursion' do
expect(subject).to contain_file('/etc/my.cnf.d').with(ensure: :directory,
recurse: true,
purge: true )
end
end

it { is_expected.to contain_file('mysql-config-file').with_content(%r{!includedir}) }
Expand Down
Loading