July 14, 2009 -
For our subversion repositories we only allow users to connect through ssh public key login. We are switching towards using Fabric for doing automated deployments (in combination with zc.buildout, which we already use).
Unfortunately it seems that both Fabric and paramiko, the python library Fabric uses for making ssh connections, don't support the ForwardAgent option in ~/.ssh/config which allows you to forward your ssh-agent to a remote machine and from there connect to other machines using your public key.
A workaround for this is relatively simple though. Instead of using run() to perform the svn update remotely through Fabric and Paramiko, you can use the local() command to initiate an ssh connection using your local system's ssh command:
from fabric.api import *
env.hosts = ['my_server.example.org']
env.project_root = '[/srv/my_project]'
"Deploy code to servers"
require('hosts', provided_by = [staging])
local('ssh %s "svn up %s"' % (env.host, env.project_root))
This will do an svn update on the checkout in /srv/my_project on the host my_server.example.org.