So, I changed things around to this:
task :after_symlink, :roles => :app do
sudo "rm -rf #{current_path}/public/attachments"
sudo "rm -rf #{current_path}/public/logos"
sudo "ln -nsf #{nfs_share}/attachments #{current_path}/public/
attachments"
sudo "ln -nsf #{nfs_share}/logos #{current_path}/public/logos"
sudo "ln -nsf /var/www/ids/shared/config/database.yml
#{current_path}/config/database.yml"
sudo "ln -nsf #{deploy_to}/shared/config/mongrel_cluster.yml
#{current_path}/config/mongrel_cluster.yml"
end
after "after_symlink", :websymlink, :roles => :web
task :websymlink, :roles => :web do
sudo "rm -rf #{current_path}/public/attachments"
sudo "rm -rf #{current_path}/public/logos"
sudo "ln -nsf #{deploy_to}/shared/attachments #{current_path}/public/
attachments"
sudo "ln -nsf #{deploy_to}/shared/logos #{current_path}/public/
logos"
end
And it still executes :websymlink on both :app and :web instead of
just :web.
triggering after callbacks for `after_symlink'
* executing `websymlink'
* executing "sudo -p 'sudo password: ' rm -rf /var/www/ids/test/
public/attachments"
servers: ["leatherface", "localhost"]
[localhost] executing command
[leatherface] executing command
command finished
localhost is in the :web role and leatherface, a vm on my local
machine, is in the :app role.
On Jul 2, 8:31 am, "miss.magenta" <[EMAIL PROTECTED]> wrote:
> I have one task that is scoped to :app that calls another task that is
> scoped to :web. When the second task is called, it is applied to
> both :app and :web instead of just :web. Is this expected behavior?
> I thought in 2.4.0 and above that tasks would only act on the roles
> they are assigned to regardless of what role the calling task is
> assigned to.
>
> Am I missing something?
>
> Here are my tasks:
>
> desc "Relink static assets for application servers"
> task :after_symlink, :role => :app do
> sudo "rm -rf #{current_path}/public/attachments"
> sudo "rm -rf #{current_path}/public/logos"
> sudo "ln -nsf #{nfs_share}/attachments #{current_path}/public/
> attachments"
> sudo "ln -nsf #{nfs_share}/logos #{current_path}/public/logos"
> sudo "ln -nsf /var/www/ids/shared/config/database.yml
> #{current_path}/config/database.yml"
> sudo "ln -nsf #{deploy_to}/shared/config/mongrel_cluster.yml
> #{current_path}/config/mongrel_cluster.yml"
>
> websymlink
> end
>
> desc "Relink static assets for web servers"
> task :websymlink, :role => :web do
> sudo "rm -rf #{current_path}/public/attachments"
> sudo "rm -rf #{current_path}/public/logos"
> sudo "ln -nsf #{deploy_to}/shared/attachments #{current_path}/public/
> attachments"
> sudo "ln -nsf #{deploy_to}/shared/logos #{current_path}/public/
> logos"
> end
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---