Can anyone verify that the following patch works for them?
Index: lib/capistrano/scm/subversion.rb
===================================================================
--- lib/capistrano/scm/subversion.rb (revision 6027)
+++ lib/capistrano/scm/subversion.rb (working copy)
@@ -50,7 +50,7 @@
from ||= current_revision(actor)
to ||= "HEAD"
- `svn diff [EMAIL PROTECTED] #
[EMAIL PROTECTED]
+ `svn diff #{authorization} [EMAIL PROTECTED]
{from} [EMAIL PROTECTED]
end
# Check out (on all servers associated with the current task)
the latest
@@ -60,8 +60,7 @@
# remote server.)
def checkout(actor)
op = configuration[:checkout] || "co"
- username = configuration[:svn_username] ? "--username #
{configuration[:svn_username]}" : ""
- command = "#{svn} #{op} #{username} -q -r#
{configuration.revision} #{configuration.repository} #
{actor.release_path} &&"
+ command = "#{svn} #{op} #{authorization} -q -r#
{configuration.revision} #{configuration.repository} #
{actor.release_path} &&"
run_checkout(actor, command, &svn_stream_handler(actor))
end
@@ -78,8 +77,14 @@
configuration[:svn] || "svn"
end
+ def authorization
+ username = configuration[:svn_username] ? "--username #
{configuration[:svn_username]}" : ""
+ password = configuration[:svn_password] ? "--password #
{configuration[:svn_password]}" : ""
+ "#{username} #{password}"
+ end
+
def svn_log(path)
- `svn log -q --limit 1 #{path}`
+ `svn log #{authorization} -q --limit 1 #{path}`
end
def svn_password
On Jan 25, 2007, at 11:16 AM, Charles Brian Quinn wrote:
>
> Paul, on the svn_log, I altered my capistrano lib locally for one
> application:
>
>
>
> module Capistrano
> module SCM
>
> class Subversion < Base
>
> private
> def svn_log(path)
> `svn log -q --limit 1 #{path} --username #{svn_username}
> --password #{svn_password} --no-auth-cache`
> end
>
> def svn_username
> configuration[:svn_username] || configuration[:username]
> end
>
> end
>
>
> So as not to auth-cache and to add the svn_username since it doesn't
> cache auth credentials.
>
> this could be applied to trunk, now that I think about it, i thought
> it was just me and a special circumstance.
>
>
> On 1/25/07, Paul Stadig <[EMAIL PROTECTED]> wrote:
>>
>> I figured out a hack to get it to work using a monkey patch in my
>> deploy.rb file:
>>
>> class Capistrano::SCM::Base
>> private
>> alias_method :run_checkout_old, :run_checkout
>> def run_checkout(actor, guts, &block)
>> run_checkout_old(actor, "eval `keychain --eval id_rsa` && #
>> {guts}",
>> &block)
>> end
>> end
>>
>> I would rather hear better alternatives if there are any.
>> Additionally
>> I think I found a bug in Capistrano, I was getting the error
>>
>> * querying latest revision...
>> Permission denied (publickey,keyboard-interactive).
>> svn: Connection closed unexpectedly
>>
>> and I assumed it was a problem with the ssh-agent on my app server
>> when
>> it was trying to check out the code. It is actually a problem on my
>> local machine, and I think it is because the svn_log method on the
>> SCM::Subversion class is not using the :subversion_username
>> config. My
>> username on my local machine is different than the username on my SVN
>> server.
>>
>> At least I think that's the problem, but I may be wrong?
>>
>>
>> Paul
>>
>> On Jan 25, 11:09 am, "Paul Stadig" <[EMAIL PROTECTED]> wrote:
>>> I've search through the group, and I've been trying to figure out
>>> a way
>>> to setup public/private key deployment for my particular situation.
>>>
>>> My SVN server is separate from my app server, and it requires public
>>> key auth. I understand that Net::SSH does not support agent
>>> forwarding,
>>> so I figured I have two options: 1) create a passwordless key
>>> just for
>>> checking out from SVN (not totally desirable), or 2) setup a long
>>> running ssh-agent using keychain
>>> (http://www.gentoo.org/proj/en/keychain/).
>>>
>>> I've tried adding keychain to different files on my SVN server
>>> (~/.bashrc, ~/.bash_profile, /etc/bash.bashrc, /etc/profile), but
>>> I'm
>>> never able to get the ssh-agent environment variables to work with
>>> capistrano. I'm not sure if the way capistrano is connecting it
>>> isn't
>>> sourcing my .bashrc file or something?
>>>
>>> I've even tried running keychain in my before_update_code to set the
>>> environment variables:
>>>
>>> task :before_update_code do
>>> run 'env'
>>> run 'keychain id_rsa' do |channel, stream, data|
>>> if data =~ /^Enter passphrase/
>>> $stdout.write("Please enter your SSH key password: ")
>>> pwd = $stdin.readline
>>> $stdout.puts pwd
>>> channel.send_data pwd
>>> end
>>> end
>>> run 'env'
>>> end
>>>
>>> This works in the sense that the next time I log in to my SVN server
>>> keychain automatically picks up my ssh key, but the capistrano
>>> session
>>> does not seem to pick up the environment variables for the ssh-
>>> agent.
>>>
>>> So, capistrano won't pick up the environment variables from my
>>> profile,
>>> and I can't inject environment variables into the capistrano
>>> session.
>>> Does any one know how to accomplish either of these two?
>>>
>>> TIA,
>>> Paul
>>
>>
>>>
>>
>
>
> --
> Charles Brian Quinn
> self-promotion: www.seebq.com
> highgroove studios: www.highgroove.com
> slingshot hosting: www.slingshothosting.com
> main: 678.389.9462 fax: 678.826.0969
>
> Ruby on Rails Bootcamp at the Big Nerd Ranch
> Intensive Ruby on Rails Training:
> http://www.bignerdranch.com/classes/ruby.shtml
>
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---