Versions:

   - Ruby 1.8.7
   - Capistrano v2.5.5
   - Rake / Rails / etc

Platform:

   - CentOS/Red Hat


I'm trying to write a task (to be called from a Perl script) that will work 
on any Linux host in my environment. However, since there is only one host 
that can SSH to every other host (it can also receive SSH connections from 
any host), and I can't guarantee that the task will be running on that 
host, I need to find a way to run the task on that host.

Here's what I came up with so far:


set :user, usr

cmd = "getpass " + user
set :password, `#{cmd}`

task :distribute, :on_error => :continue do
  host_list = hosts.split(',')
  servers = []
  host_list.each do |n|
    servers.push([n])
  end
  filelist=files.split(',')
  filelist.each do |f|
    upload f, target_dir, { :via => :scp, :hosts => servers, :on_error => 
:continue  }
  end
end

to be invoked like this:

/usr/bin/cap -f distribute_file.rb -S usr=user_to_run_as -s 
target_dir=/path/to/target -s files=/path/to/source_file -s hosts=(list of 
hosts) HOST=master_host

but that caused it to only run against master_host

So then I tried executing it with SSH, but that had a tendency to hang, 
plus it seemed to me like there should be a built-in method for this.

I'm a Perl guy and am new to both Ruby and capistrano, so please be gentle 
:)

Thanks.

-- 
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.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/5014b7b3-78f4-44ed-9099-6fce08743222%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to