Skip to content

Commit

Permalink
Merge pull request #190 from jcpunk/claim-ownership
Browse files Browse the repository at this point in the history
Add ownership of cachedir to puppet if claiming ownership
  • Loading branch information
traylenator authored Feb 6, 2024
2 parents 0ddce5f + 47d6147 commit 9131c9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
String[1] $cvmfs_version = $cvmfs::cvmfs_version,
Stdlib::Absolutepath $cvmfs_cache_base = $cvmfs::cvmfs_cache_base,
Optional[Boolean] $fuse3 = $cvmfs::fuse3,
Optional[Enum['yes','no']] $cvmfs_claim_ownership = $cvmfs::cvmfs_claim_ownership,
) inherits cvmfs {
# Create the cache dir if one is defined, otherwise assume default is in the package.
# Require the package so we know the user is in place.
Expand All @@ -14,7 +15,7 @@
# Compare the default value with the one from hiera if declared
$default_cvmfs_cache_base = '/var/lib/cvmfs'

if $cvmfs_cache_base != $default_cvmfs_cache_base {
if ($cvmfs_claim_ownership == 'yes') or ($cvmfs_cache_base != $default_cvmfs_cache_base) {
file { $cvmfs_cache_base:
ensure => directory,
owner => $cvmfs::cvmfs_cache_owner,
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@
it do
is_expected.to contain_concat__fragment('cvmfs_default_local_header').
without_content(%r{^CVMFS_CLAIM_OWNERSHIP})
is_expected.not_to contain_file('/var/lib/cvmfs')
end
end

Expand All @@ -543,6 +544,7 @@
it do
is_expected.to contain_concat__fragment('cvmfs_default_local_header').
with_content(%r{^CVMFS_CLAIM_OWNERSHIP='yes'$})
is_expected.to contain_file('/var/lib/cvmfs').with_owner('cvmfs').with_group('cvmfs')
end
end

Expand Down

0 comments on commit 9131c9c

Please sign in to comment.