Skip to content

Fix execute chown and chgrp for symlink #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cache: bundler
before_install:
- bundle -v
- rm -f Gemfile.lock
- gem update --system
- gem i rubygems-update -v '<3' && update_rubygems
- gem --version
- bundle -v
script:
Expand Down
11 changes: 9 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
default: { '-c' } # Beautifully verbose output
}

# -h --no-dereference
# affect each symbolic link instead of any referenced file
# (useful only on systems that can change the ownership/group of a symlink)
$h = case $facts['os']['family'] {
default: { '-h' }
}

$validators = [
{ input => $file_mode,
find => shellquote('(', '-type', 'f', '!', '-perm', $file_mode, ')'),
Expand All @@ -51,11 +58,11 @@
},
{ input => $owner,
find => shellquote('(', '!', '-user', $owner, ')'),
fix => "-exec chown ${v} ${shellquote($owner)} {} \\;",
fix => "-exec chown ${v} ${h} ${shellquote($owner)} {} \\;",
},
{ input => $group,
find => shellquote('(', '!', '-group', $group, ')'),
fix => "-exec chgrp ${v} ${shellquote($group)} {} \\;",
fix => "-exec chgrp ${v} ${h} ${shellquote($group)} {} \\;",
},
]

Expand Down