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

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

Open
tomcant opened this issue Mar 14, 2017 · 0 comments

Comments

@tomcant
Copy link
Contributor

tomcant commented Mar 14, 2017

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant