Skip to content
Merged
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
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ Data type: `String[1]`

group owner of dotfile

Default value: `'root'`
Default value: `getvar('python::params::group')`

##### <a name="-python--dotfile--config"></a>`config`

Expand Down
2 changes: 1 addition & 1 deletion manifests/dotfile.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Enum['absent', 'present'] $ensure = 'present',
Stdlib::Absolutepath $filename = $title,
String[1] $owner = 'root',
String[1] $group = 'root',
String[1] $group = getvar('python::params::group'),
Stdlib::Filemode $mode = '0644',
Hash $config = {},
) {
Expand Down
14 changes: 12 additions & 2 deletions spec/defines/dotfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
facts
end

let(:root_group) do
if facts[:os]['family'] == 'FreeBSD'
'wheel'
else
'root'
end
end

let(:pre_condition) { 'include python' }

describe 'dotfile as' do
context 'fails with empty string filename' do
let(:title) { '' }
Expand All @@ -32,15 +42,15 @@
context 'succeeds with filename in a non-existing path' do
let(:title) { '/home/someuser/.pip/pip.conf' }

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') }
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") }
it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_mode('0644') }
end

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

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') }
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") }
it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_owner('someuser') }
end

Expand Down