3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/da044e190f11/
Changeset: da044e190f11
User: martenson
Date: 2015-02-23 15:44:51+00:00
Summary: fix toolshed auth API returning double converted json
allow sessionless key retrieval
Affected #: 1 file
diff -r 67222d8cb3a54c7a3dc28accc8f16ff502fe547b -r
da044e190f11d33a8556aa60ff563f1e801abf6d lib/galaxy/webapps/tool_shed/api/authenticate.py
--- a/lib/galaxy/webapps/tool_shed/api/authenticate.py
+++ b/lib/galaxy/webapps/tool_shed/api/authenticate.py
@@ -13,13 +13,14 @@
from galaxy import web
from galaxy.webapps.galaxy.api.authenticate import AuthenticationController
+from galaxy.web import _future_expose_api_raw_anonymous_and_sessionless as
expose_api_raw_anonymous_and_sessionless
log = logging.getLogger( __name__ )
class ToolShedAuthenticationController( AuthenticationController ):
- @web.expose_api_anonymous
+ @expose_api_raw_anonymous_and_sessionless
def get_tool_shed_api_key( self, trans, **kwd ):
"""
def get_api_key( self, trans, **kwd )
https://bitbucket.org/galaxy/galaxy-central/commits/d06aa2582d93/
Changeset: d06aa2582d93
User: martenson
Date: 2015-02-23 15:54:52+00:00
Summary: Return more specific API auth errors
Affected #: 1 file
diff -r da044e190f11d33a8556aa60ff563f1e801abf6d -r
d06aa2582d9353a39fe7e6afccfa34d58464551f lib/galaxy/webapps/galaxy/api/authenticate.py
--- a/lib/galaxy/webapps/galaxy/api/authenticate.py
+++ b/lib/galaxy/webapps/galaxy/api/authenticate.py
@@ -45,9 +45,11 @@
user = trans.sa_session.query( trans.app.model.User ).filter(
trans.app.model.User.table.c.email == email ).all()
- if ( len( user ) is not 1 ):
- # DB is inconsistent and we have more users with same email
- raise exceptions.ObjectNotFound()
+ if ( len( user ) == 0 ):
+ raise exceptions.ObjectNotFound( 'The user does not exist.' )
+ elif ( len( user ) > 1 ):
+ # DB is inconsistent and we have more users with the same email.
+ raise exceptions.InconsistentDatabase( 'An error occured, please contact
your administrator.' )
else:
user = user[0]
is_valid_user = user.check_password( password )
@@ -55,7 +57,7 @@
key = self.api_keys_manager.get_or_create_api_key( user )
return dict( api_key=key )
else:
- raise exceptions.AuthenticationFailed()
+ raise exceptions.AuthenticationFailed( 'Invalid password.' )
def _decode_baseauth( self, encoded_str ):
"""
https://bitbucket.org/galaxy/galaxy-central/commits/cc3c4f51d1ea/
Changeset: cc3c4f51d1ea
User: jmchilton
Date: 2015-02-18 16:34:23+00:00
Summary: Tool diagnostic API endpoints.
It is easy to get Galaxy's database and shed tool files out of sync and the results
are bad. I don't think this is new but I may have made it worse this cycle by trying
to slowly walk back Galaxy's use of the database to track lineages (e.g.
https://bitbucket.org/galaxy/galaxy-central/commits/08f8850853d004bf8a456...).
New API endpoints include:
/api/configuration/dynamic_tool_confs
/api/configuration/tool_lineages
/api/<tool_id>/diagnostics
Affected #: 6 files
diff -r d06aa2582d9353a39fe7e6afccfa34d58464551f -r
cc3c4f51d1ea571608b017c1d1fc8100f6ad9e35 lib/galaxy/tools/toolbox/lineages/interface.py
--- a/lib/galaxy/tools/toolbox/lineages/interface.py
+++ b/lib/galaxy/tools/toolbox/lineages/interface.py
@@ -40,3 +40,9 @@
externally).
"""
return self.version is None
+
+ def to_dict(self):
+ return dict(
+ id=self.id,
+ version=self.version,
+ )
diff -r d06aa2582d9353a39fe7e6afccfa34d58464551f -r
cc3c4f51d1ea571608b017c1d1fc8100f6ad9e35 lib/galaxy/tools/toolbox/lineages/stock.py
--- a/lib/galaxy/tools/toolbox/lineages/stock.py
+++ b/lib/galaxy/tools/toolbox/lineages/stock.py
@@ -38,6 +38,13 @@
# method for comparing tool versions.
return sorted( versions, key=_to_loose_version )
+ def to_dict(self):
+ return dict(
+ tool_id=self.tool_id,
+ tool_versions=list(self.tool_versions),
+ lineage_type='stock',
+ )
+
def _to_loose_version( tool_lineage_version ):
version = str( tool_lineage_version.version )
diff -r d06aa2582d9353a39fe7e6afccfa34d58464551f -r
cc3c4f51d1ea571608b017c1d1fc8100f6ad9e35 lib/galaxy/tools/toolbox/lineages/tool_shed.py
--- a/lib/galaxy/tools/toolbox/lineages/tool_shed.py
+++ b/lib/galaxy/tools/toolbox/lineages/tool_shed.py
@@ -8,9 +8,11 @@
""" Representation of tool lineage derived from tool shed repository
installations. """
- def __init__(self, app, tool_version):
+ def __init__(self, app, tool_version, tool_shed_repository=None):
self.app = app
self.tool_version_id = tool_version.id
+ # Only used for logging
+ self._tool_shed_repository = tool_shed_repository
@staticmethod
def from_tool( app, tool, tool_shed_repository ):
@@ -36,6 +38,16 @@
def get_versions( self, reverse=False ):
return map( ToolLineageVersion.from_guid, self.get_version_ids( reverse=reverse )
)
+ def to_dict(self):
+ tool_shed_repository = self._tool_shed_repository
+ rval = dict(
+ tool_version_id=self.tool_version_id,
+ tool_versions=map(lambda v: v.to_dict(), self.get_versions()),
+ tool_shed_repository=tool_shed_repository if tool_shed_repository is not None
else None,
+ lineage_type='tool_shed',
+ )
+ return rval
+
def get_install_tool_version( app, tool_id ):
return app.install_model.context.query(
diff -r d06aa2582d9353a39fe7e6afccfa34d58464551f -r
cc3c4f51d1ea571608b017c1d1fc8100f6ad9e35 lib/galaxy/webapps/galaxy/api/configuration.py
--- a/lib/galaxy/webapps/galaxy/api/configuration.py
+++ b/lib/galaxy/webapps/galaxy/api/configuration.py
@@ -4,6 +4,8 @@
"""
from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous
+from galaxy.web import _future_expose_api as expose_api
+from galaxy.web import require_admin
from galaxy.web.base.controller import BaseAPIController
from galaxy.managers import base
@@ -33,6 +35,13 @@
@expose_api_anonymous
def version( self, trans, **kwds ):
+ """
+ GET /api/version
+ Return a description of the major version of Galaxy (e.g. 15.03).
+
+ :rtype: dict
+ :returns: dictionary with major version keyed on 'version_major'
+ """
return {"version_major": self.app.config.version_major }
def get_config_dict( self, trans, return_admin=False, view=None, keys=None,
default_view='all' ):
@@ -52,6 +61,29 @@
view=view, keys=keys,
default_view=default_view )
return serialized
+ @expose_api
+ @require_admin
+ def dynamic_tool_confs(self, trans):
+ confs = self.app.toolbox.dynamic_confs(include_migrated_tool_conf=True)
+ return map(_tool_conf_to_dict, confs)
+
+ @expose_api
+ @require_admin
+ def tool_lineages(self, trans):
+ rval = []
+ for id, tool in self.app.toolbox.tools():
+ if hasattr( tool, 'lineage' ):
+ lineage_dict = tool.lineage.to_dict()
+ else:
+ lineage_dict = None
+
+ entry = dict(
+ id=id,
+ lineage=lineage_dict
+ )
+ rval.append(entry)
+ return rval
+
#TODO: for lack of a manager file for the config. May well be better in config.py? Circ
imports?
class ConfigSerializer( base.ModelSerializer ):
@@ -122,3 +154,10 @@
'allow_user_creation' : _defaults_to( False ),
'allow_user_deletion' : _defaults_to( False ),
})
+
+
+def _tool_conf_to_dict(conf):
+ return dict(
+ config_filename=conf['config_filename'],
+ tool_path=conf['tool_path'],
+ )
diff -r d06aa2582d9353a39fe7e6afccfa34d58464551f -r
cc3c4f51d1ea571608b017c1d1fc8100f6ad9e35 lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -94,6 +94,36 @@
message, status = trans.app.toolbox.reload_tool_by_id( tool_id )
return { status: message }
+ @_future_expose_api
+ @web.require_admin
+ def diagnostics( self, trans, id, **kwd ):
+ """
+ GET /api/tools/{tool_id}/diagnostics
+ Return diagnostic information to help debug panel
+ and dependency related problems.
+ """
+ to_dict = lambda x: x.to_dict()
+ tool = self._get_tool( id, user=trans.user )
+ if hasattr( tool, 'lineage' ):
+ lineage_dict = tool.lineage.to_dict()
+ else:
+ lineage_dict = None
+ tool_shed_dependencies = tool.installed_tool_dependencies
+ if tool_shed_dependencies:
+ tool_shed_dependencies_dict = map(to_dict, tool_shed_dependencies)
+ else:
+ tool_shed_dependencies_dict = None
+ tool = self._get_tool( id, user=trans.user )
+ return {
+ "tool_id": tool.id,
+ "tool_version": tool.version,
+ "dependency_shell_commands":
tool.build_dependency_shell_commands(),
+ "lineage": lineage_dict,
+ "requirements": map(to_dict, tool.requirements),
+ "installed_tool_shed_dependencies": tool_shed_dependencies_dict,
+ "tool_dir": tool.tool_dir,
+ }
+
@_future_expose_api_anonymous
def citations( self, trans, id, **kwds ):
tool = self._get_tool( id, user=trans.user )
diff -r d06aa2582d9353a39fe7e6afccfa34d58464551f -r
cc3c4f51d1ea571608b017c1d1fc8100f6ad9e35 lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -210,6 +210,7 @@
webapp.mapper.resource_with_deleted( 'quota', 'quotas',
path_prefix='/api' )
webapp.mapper.connect( '/api/tools/{id:.+?}/build', action='build',
controller="tools" )
webapp.mapper.connect( '/api/tools/{id:.+?}/reload', action='reload',
controller="tools" )
+ webapp.mapper.connect( '/api/tools/{id:.+?}/diagnostics',
action='diagnostics', controller="tools" )
webapp.mapper.connect( '/api/tools/{id:.+?}/citations',
action='citations', controller="tools" )
webapp.mapper.connect( '/api/tools/{id:.+?}/download',
action='download', controller="tools" )
webapp.mapper.connect( '/api/tools/{id:.+?}', action='show',
controller="tools" )
@@ -221,6 +222,18 @@
webapp.mapper.resource( 'workflow', 'workflows',
path_prefix='/api' )
webapp.mapper.resource_with_deleted( 'history', 'histories',
path_prefix='/api' )
webapp.mapper.connect( '/api/histories/{history_id}/citations',
action='citations', controller="histories" )
+ webapp.mapper.connect(
+ 'dynamic_tool_confs',
+ '/api/configuration/dynamic_tool_confs',
+ controller="configuration",
+ action="dynamic_tool_confs"
+ )
+ webapp.mapper.connect(
+ 'tool_lineages',
+ '/api/configuration/tool_lineages',
+ controller="configuration",
+ action="tool_lineages"
+ )
webapp.mapper.resource( 'configuration', 'configuration',
path_prefix='/api' )
webapp.mapper.connect( "configuration_version",
"/api/version",
controller="configuration",
Repository URL:
https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.