Skip to content

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

@tomcant

Description

@tomcant

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions