Skip to content

Commit

Permalink
Merge pull request #287 from j-vizcaino/feature/setup-user-group-expl…
Browse files Browse the repository at this point in the history
…icitly

setup: set user/group explicitly for dirs & script
  • Loading branch information
hunner committed Apr 7, 2015
2 parents 936dc29 + c2d056b commit 6f88096
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions manifests/setup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand All @@ -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',
}
}
6 changes: 6 additions & 0 deletions spec/unit/classes/concat_setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand All @@ -28,6 +30,8 @@
should contain_file(file).with({
:ensure => 'directory',
:mode => '0755',
:owner => 'root',
:group => 0,
:backup => false,
})
end
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 6f88096

Please sign in to comment.