fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Fabric Run Prompt


From: Rory Campbell-Lange
Subject: Re: [Fab-user] Fabric Run Prompt
Date: Mon, 21 Nov 2011 22:12:32 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On 21/11/11, Kyle B (address@hidden) wrote:
> The svn server we have uses http auth. So when I have fabric run that
> command, it immediately responds back with asking for my password for
> the username "kyle" passed above on the command line.

The http auth bit is easy to solve in Python:

http://www.voidspace.org.uk/python/articles/authentication.shtml

    # basic auth
    import urllib2
    theurl = 'http://www.someserver.com/toplevelurl/somepage.htm'
    username = 'johnny'
    password = 'XXXXXX'
    passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
    passman.add_password(None, theurl, username, password)
    authhandler = urllib2.HTTPBasicAuthHandler(passman)
    opener = urllib2.build_opener(authhandler)
    urllib2.install_opener(opener)
    pagehandle = urllib2.urlopen(theurl)

I did this for our https HTTP Digest authenticated svn server:

    # htdigest auth
    import urllib2
    user = 'rory'
    pass = 'uMe3kiequoxeziephaYi'
    url  = 'https://svn.mycodeserver/project/'
    passman.add_password('My Repo', url, user, pass)
    authhandler = urllib2.HTTPDigestAuthHandler(passman)
    opener = urllib2.build_opener(authhandler)
    urllib2.install_opener(opener)
    pagehandle = urllib2.urlopen(theurl)

How you can pass this to the standard svn client is not so clear. 

It might be easier to use something like the pysvn Python client module
on each target server:

    import pysvn
    p = pysvn.Client()
    p.set_default_username ('rory')
    p.set_default_password ('xyz')
    p.checkout(url='https://svn.mycodeserver/project/', path='/project/')
    ...

Its obviously trivial to do this sort of thing if your svn also works
over ssh, and you can pass on the authentication credentials via
agent-forwarding.

Another solution is to use Kerberos, assuming each client server has an
active Kerberos session in play which is valid for the Subversion server
ahead of your fabric deployment being put in action.

Other cool solutions for this sort of thing would be to move to DVCS and
send -- say -- Mercurial bundle files for local checkout and/or updates.
DCVS can be much more flexible in these cases.

-- 
Rory Campbell-Lange
address@hidden

Campbell-Lange Workshop
www.campbell-lange.net
0207 6311 555
3 Tottenham Street London W1T 2AF
Registered in England No. 04551928



reply via email to

[Prev in Thread] Current Thread [Next in Thread]