Skip to content
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

Replace hardcoded setfacl mode by variables and update documentation #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Assume `app/logs` is a shared directory, and `app/cache` is part of the normal
release, this gem would execute the following:

```
[..] setfacl -Rn -m u:www-data:rwX -m u:<deploy-user>:rwX <path-to-app>/shared/app/logs <path-to-app>/<release>/app/cache
[..] setfacl -R -m u:www-data:rwX -m u:<deploy-user>:rwX <path-to-app>/shared/app/logs <path-to-app>/<release>/app/cache
```

### Other tasks
Expand All @@ -65,6 +65,9 @@ set :file_permissions_paths, []
set :file_permissions_users, []
set :file_permissions_groups, []
set :file_permissions_chmod_mode, "0777"
set :file_permissions_setfacl_first, "-R"
set :file_permissions_setfacl_second, "-dR"
set :file_permissions_default_permissions, "rwX"
```

## Contributing
Expand Down
9 changes: 6 additions & 3 deletions lib/capistrano/tasks/file-permissions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def absolute_writable_paths
end
end

def acl_entries(items, type = 'u', permissions = 'rwX')
def acl_entries(items, type = 'u', permissions = fetch(:file_permissions_default_permissions))
items.map { |item| "#{type}:#{item}:#{permissions}" }
end

Expand Down Expand Up @@ -42,8 +42,8 @@ namespace :deploy do

entries = entries.map { |e| "-m #{e}" }.join(' ')

execute :setfacl, "-R", entries, *paths
execute :setfacl, "-dR", entries, *paths.map
execute :setfacl, fetch(:file_permissions_setfacl_first), entries, *paths
execute :setfacl, fetch(:file_permissions_setfacl_second), entries, *paths.map
end
end

Expand Down Expand Up @@ -98,5 +98,8 @@ namespace :load do
set :file_permissions_users, []
set :file_permissions_groups, []
set :file_permissions_chmod_mode, "0777"
set :file_permissions_setfacl_first, "-Rn"
set :file_permissions_setfacl_second, "-dRn"
set :file_permissions_default_permissions, "rwX"
end
end