Try using an ENV variable other than 'hosts' like 'myhosts' I think cap may use 
the hosts ENV variable under the hood. Name the ruby variable myhosts as well 
just for good measure. 

Now the call to ls -xt. Is in a capture it only runs against one host by 
design. If it finds stuff to delete then it will do the deletes across the 
servers. What is your keep_releases value?

Why is the path it's checking literally /path/to/releases?

Are you obfuscating the path in your paste?  Or is that really the output?

If that's really the output and your deploy_to isn't /path/to you have some 
sorting out to do in your recipes. 

Don't even look at the following link until you can run the canned 
deploy:cleanup. 

I've used this method in the past that was useful when the release directories 
were out of sync, the downside is it's slow and the more hosts you have the 
slower it is. I ended up removing it once my directories were back in sync.

 http://blog.perplexedlabs.com/2010/09/08/improved-deploycleanup-for-capistrano/

On Aug 17, 2013, at 5:24 PM, "C. Benson Manica" <cbman...@gmail.com> wrote:

> Hm, I would swear up and down that I tried exactly that several times and got 
> odd error messages. Trying it now, however, still doesn't appear to do what I 
> need - setting the variable to "server1,server2" yields the following output
> 
> triggering load callbacks
>   * 2013-08-17 17:22:59 executing `deploy:cleanup'
>   * executing "ls -xt /path/to/releases"
>     servers: ["server1"]
>     [server1] executing command
>     command finished in 512ms
> *** no old releases to clean up
> 
> It doesn't try to remove old releases on server2.
> 
> On Thursday, August 15, 2013 8:37:31 PM UTC-7, dbray wrote:
>> 
>> Ahh the problem lies not in cap but your definition
>> 
>> hosts=ENV['hosts'].split(',')
>> hosts.each do |instance|
>>   role :web, *hosts
>>   role :app, *hosts
>>   role :db, *hosts
>> end
>> 
>> If your hosts is really semi colon delimited the host.each loop is 
>> unnecessary the splat operator takes care of it. 
>> 
>> hosts may also be a reserved name in capistrano
>> 
>> If hosts is not reserved, and you've really fed the environment variable a 
>> comma delimited list then
>> 
>> hosts=ENV['hosts'].split(',').map(&:strip)
>> role :web, *hosts
>> role :app, *hosts
>> role :db, *hosts
>> 
>> (I would strip the results for safety.)
>> 
>> Should be enough, or switch it around to the server helper and don't even 
>> bother with an intermediate variable. 
>> 
>> ENV['hosts'].split(',').map(&:strip).each do |instance|
>>   server instance, :web, :app, :db
>> end
>> 
>> On Aug 14, 2013, at 10:47 PM, "C. Benson Manica" <cbma...@gmail.com> wrote
>> 
>>> Why does 
>>> 
>>> https://gist.github.com/cbmanica/62385
>>> 
>>> only execute deploy:cleanup on one of the hosts specified? And why hasn't 
>>> anyone on the entire internet documented how to accomplish such a seemingly 
>>> universal task?
>>> -- 
>>> -- 
>>> * You received this message because you are subscribed to the Google Groups 
>>> "Capistran group.
>>> * To post to this group, send email to capis...@googlegroups.com
>>> * To unsubscribe from this group, send email to 
>>> capistrano+...@googlegroups.com For more options, visit this group at 
>>> http://groups.google.com/group/capistrano?hl=en
>>> --- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Capistrano" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to capistrano+...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> -- 
> -- 
> * You received this message because you are subscribed to the Google Groups 
> "Capistrano" group.
> * To post to this group, send email to capistrano@googlegroups.com
> * To unsubscribe from this group, send email to 
> capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/capistrano?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Capistrano" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to capistrano+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to capistrano@googlegroups.com
* To unsubscribe from this group, send email to 
capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capistrano+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to