So...do you just want the port number for the first matching server?
Because, in general, the task could be run for multiple hosts
simultaneously. (In your case, it probably isn't.) If all you want is
the port number for the first host that matches the given task, you
could do:
port = find_servers_for_task(current_task).first.port
- Jamis
On 9/21/07, heimdull <[EMAIL PROTECTED]> wrote:
>
>
> The task that I have now is for a database backup...
>
> task :backup, :roles => :db, :only => { :primary => true } do
> filename =
> "#{stage}.#{application}.dump.#{Time.now.to_i}.sql.bz2"
> file = "/tmp/#{filename}"
> on_rollback { run "rm #{file}"; true }
> run "mysqldump -u root #{application}_#{stage} | bzip2 -c >
> #{file}" do |ch, stream, data|
> puts data
> end
> `mkdir -p #{File.dirname(__FILE__)}/../backups/`
> `rsync [EMAIL PROTECTED]:db][0].host}:#{file}
> #{File.dirname(__FILE__)}/../backups/`
> end
>
> But I need the port number and I thought the role would be a great
> place to put that.
>
> Is there a current.role.get.port or current.task.role? I'm not the
> best ruby programmer (just started with Ruby and Capistrano) so if you
> have an example that would help greatly..
>
> I see this as something we would use for qa where we have multiple
> databases running on one server with different ports.
>
> Sorry about the newbee questions.
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---