capistrano / capistrano/symfony

Task symfony:set_permissions invokes task deploy:set_permissions:* for each server in "release_roles :all"

Open Beginner friendly
#78 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
353
Forks
61
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm working against capistrano `3.8` with capistrano-symfony `1.0.0.rc2` and I'm receiving the following error when deploying to an application with more than one host configured:

![capistrano-symfony-invokes-task-multiple-times](https://cloud.githubusercontent.com/assets/1046961/23922442/4a8043c4-08fa-11e7-947a-e997e4496bbb.png)

Due to the nature of Rake each task can only be invoked once (unless manually reset with `Rake::Task[...].reenable`). Task `symfony:set_permissions` on line 61 of `lib/capistrano/tasks/symfony.rake` calls Capistrano DSL method `invoke` inside an `on` block:
```
task :set_permissions do
on release_roles :all do
if fetch(:permission_method) != false
invoke "deploy:set_permissions:#{fetch(:permission_method).to_s}"
end
end
end
```
This means that if there are multiple hosts defined and `release_roles :all` returns more than one then the call to `invoke` happens more than once. Looking at the implementation of task `deploy:set_permissions:acl` for example, we see that it filters the hosts itself anyway:
```
task :acl => [:check] do
...
on roles fetch(:file_permissions_roles) do |host|
...
```
... and therefore applying a filter in `symfony:set_permissions` won't do anything anyway. Proposed fix is to remove the filtering:
```
task :set_permissions do
if fetch(:permission_method) != false
invoke "deploy:set_permissions:#{fetch(:permission_method).to_s}"
end
end
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lib/capistrano/tasks/symfony.rake around line 61 and inspect how symfony:set_permissions invokes the deploy:set_permissions:* task inside the host iteration. Compare this with deploy:set_permissions:acl and its own host filtering. Done means a multi-host deployment invokes the selected permissions task only once while still applying permissions to the configured roles.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.