From 0193fd2e6d156a6ceba4454f2ebbfefae0ec0245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vizcaino?= Date: Sun, 29 Mar 2015 10:25:53 +0200 Subject: [PATCH 1/3] setup: set user/group explicitly for dirs & script --- manifests/setup.pp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/manifests/setup.pp b/manifests/setup.pp index 95cce4a16..82a082f52 100644 --- a/manifests/setup.pp +++ b/manifests/setup.pp @@ -35,9 +35,9 @@ $script_path = "${concatdir}/bin/${script_name}" - $script_owner = $::osfamily ? { 'windows' => undef, default => $::id } + $default_owner = $::osfamily ? { 'windows' => undef, default => $::id } - $script_group = $script_owner ? { 'root' => '0', default => undef } + $default_group = $default_owner ? { 'root' => '0', default => undef } $script_mode = $::osfamily ? { 'windows' => undef, default => '0755' } @@ -52,14 +52,16 @@ file { $script_path: ensure => file, - owner => $script_owner, - group => $script_group, + owner => $default_owner, + group => $default_group, mode => $script_mode, source => "puppet:///modules/concat/${script_name}", } file { [ $concatdir, "${concatdir}/bin" ]: ensure => directory, + owner => $default_owner, + group => $default_group, mode => '0755', } } From e81155023218d152bed28c152e759621ea6a4d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vizcaino?= Date: Sun, 5 Apr 2015 10:38:54 +0200 Subject: [PATCH 2/3] setup: update tests to check for proper user/group ownership --- spec/unit/classes/concat_setup_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/unit/classes/concat_setup_spec.rb b/spec/unit/classes/concat_setup_spec.rb index e97a29caa..7de9e114c 100644 --- a/spec/unit/classes/concat_setup_spec.rb +++ b/spec/unit/classes/concat_setup_spec.rb @@ -18,6 +18,8 @@ it do should contain_file("#{concatdir}/bin/concatfragments.rb").with({ :mode => '0755', + :owner => 'root', + :group => 0, :source => 'puppet:///modules/concat/concatfragments.rb', :backup => false, }) @@ -28,6 +30,8 @@ should contain_file(file).with({ :ensure => 'directory', :mode => '0755', + :owner => 'root', + :group => 0, :backup => false, }) end @@ -64,6 +68,7 @@ should contain_file("#{concatdir}/bin/concatfragments.rb").with({ :ensure => 'file', :owner => 'root', + :group => 0, :mode => '0755', :source => 'puppet:///modules/concat/concatfragments.rb', :backup => false, @@ -87,6 +92,7 @@ should contain_file("#{concatdir}/bin/concatfragments.rb").with({ :ensure => 'file', :owner => nil, + :group => nil, :mode => nil, :source => 'puppet:///modules/concat/concatfragments.rb', :backup => false, From c2d056b01caca4ff1a50a1cf103b11bb16186bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vizcaino?= Date: Sun, 5 Apr 2015 23:57:09 +0200 Subject: [PATCH 3/3] spec/setup: Fix indent --- spec/unit/classes/concat_setup_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/classes/concat_setup_spec.rb b/spec/unit/classes/concat_setup_spec.rb index 7de9e114c..84ba282c2 100644 --- a/spec/unit/classes/concat_setup_spec.rb +++ b/spec/unit/classes/concat_setup_spec.rb @@ -30,7 +30,7 @@ should contain_file(file).with({ :ensure => 'directory', :mode => '0755', - :owner => 'root', + :owner => 'root', :group => 0, :backup => false, })