Dear Galaxians,
I am behind a proxy with authentication, and I think I will contribute a
wiki page on how to install and configure galaxy for saving other people's
time...

In this mail however I would like to propose a change in the
lib/tool_shed/util/common_util.py

The problem I had was that not all tool "wrappers" could be installed using
the web interface since I was always getting an error "host not found"
generated by the urllib2.py call

>From that error message (found in paster.log) it was clear that the problem
was due to the fact I am behind a firewall with authentication, and the
http_proxy variable in the run.sh was not sufficient.

I then modified lib/tool_shed/util/common_util.py following the
instructions that I have found in

http://stackoverflow.com/questions/34079/how-to-specify-an-authenticated-proxy-for-a-python-http-connection

and then now finally it works.

Hereafter is what I've modified and it is certainly NOT the appropriate way
of doing it from a proper IT point of view (since is not good practice to
encode passwords in a source code). Furthermore, with the next mercurial
update my code changes will disappear ...  I really hope that therefore
someone of your smart people could modify the codebase accordingly, perhaps
reusing the http_proxy ... proxy_user and proxy_password system variables
:-?

------------------------------------------------------------------------------------------------------------------

def tool_shed_get( app, tool_shed_url, uri ):
    """Make contact with the tool shed via the uri provided."""
    registry = app.tool_shed_registry
#CHANGES FOR PROXY AUTH
    password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
    password_mgr.add_password(None,
'http://myproxy.domain.com:8080','MYDOMAIN\MYUSER'
, 'MYPASS')
    proxy_handler=urllib2.ProxyHandler({'http':
'http://myproxy.domain.com:8080'})
    proxy_auth_handler=urllib2.ProxyBasicAuthHandler(password_mgr)
    urlopener = urllib2.build_opener(proxy_handler,proxy_auth_handler)
#PREVIOUS CODE
#    urlopener = urllib2.build_opener()
#    password_mgr = registry.password_manager_for_url( tool_shed_url )
#    if password_mgr is not None:
#        auth_handler = urllib2.HTTPBasicAuthHandler( password_mgr )
#        urlopener.add_handler( auth_handler )
    response = urlopener.open( uri )
    content = response.read()
    response.close()
    return content
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Reply via email to