Skip to content

Commit 5c5a5bc

Browse files
committed
Include python class before testing python::dotfile
If the python class was not included in the catalog first, python::params has not been loaded, so the required group is undef causing compilation failure.
1 parent e895f49 commit 5c5a5bc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

spec/defines/dotfile_spec.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99
facts
1010
end
1111

12+
let(:root_group) do
13+
if facts[:os]['family'] == 'FreeBSD'
14+
'wheel'
15+
else
16+
'root'
17+
end
18+
end
19+
20+
let(:pre_condition) { 'include python' }
21+
1222
describe 'dotfile as' do
1323
context 'fails with empty string filename' do
1424
let(:title) { '' }
@@ -32,15 +42,15 @@
3242
context 'succeeds with filename in a non-existing path' do
3343
let(:title) { '/home/someuser/.pip/pip.conf' }
3444

35-
it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o root -g root -d /home/someuser/.pip') }
45+
it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command("install -o root -g #{root_group} -d /home/someuser/.pip") }
3646
it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_mode('0644') }
3747
end
3848

3949
context 'succeeds when set owner' do
4050
let(:title) { '/home/someuser/.pip/pip.conf' }
4151
let(:params) { { owner: 'someuser' } }
4252

43-
it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o someuser -g root -d /home/someuser/.pip') }
53+
it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command("install -o someuser -g #{root_group} -d /home/someuser/.pip") }
4454
it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_owner('someuser') }
4555
end
4656

0 commit comments

Comments
 (0)