From f50e44030ed40581b3ada6b52516a8f57ec8c214 Mon Sep 17 00:00:00 2001 From: Szparki Date: Thu, 30 Oct 2025 19:02:44 +0200 Subject: [PATCH 1/3] Making sure group ownership is not set to 'root' only, with this can handle 'wheel' in FreeBSD --- manifests/dotfile.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index 4961f12f..66d59b1e 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -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 = {}, ) { From e895f49c350e1393d617241649e42ef148900308 Mon Sep 17 00:00:00 2001 From: Szparki Date: Fri, 31 Oct 2025 11:20:22 +0200 Subject: [PATCH 2/3] Updating REFERENCE.md --- REFERENCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REFERENCE.md b/REFERENCE.md index 85da05a1..def63d6a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -420,7 +420,7 @@ Data type: `String[1]` group owner of dotfile -Default value: `'root'` +Default value: `getvar('python::params::group')` ##### `config` From 5c5a5bc9c916f89b1bbf97a0f762c578e8cce6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 31 Oct 2025 17:17:27 -1000 Subject: [PATCH 3/3] 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. --- spec/defines/dotfile_spec.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spec/defines/dotfile_spec.rb b/spec/defines/dotfile_spec.rb index 30ce21b3..a44426f7 100644 --- a/spec/defines/dotfile_spec.rb +++ b/spec/defines/dotfile_spec.rb @@ -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) { '' } @@ -32,7 +42,7 @@ 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 @@ -40,7 +50,7 @@ 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