From 5232d4e52c50e50626c09fe54ca505383f012fde Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Fri, 13 Jul 2012 19:09:51 -0400 Subject: [PATCH] Make sure a shed related tool config is defined in universe_wsgi.ini before allowing automatic tool installs from a tool shed. --- lib/galaxy/web/controllers/admin_toolshed.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/web/controllers/admin_toolshed.py b/lib/galaxy/web/controllers/admin_toolshed.py index 302d89a69ae..b2e17df211c 100644 --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -945,7 +945,7 @@ class AdminToolshed( AdminGalaxy ): @web.expose @web.require_admin def prepare_for_install( self, trans, **kwd ): - if not trans.app.toolbox.shed_tool_confs: + if not have_shed_tool_conf_for_install( trans ): message = 'The tool_config_file setting in universe_wsgi.ini must include at least one shed tool configuration file name with a ' message += '<toolbox> tag that includes a tool_path attribute value which is a directory relative to the Galaxy installation ' message += 'directory in order to automatically install tools from a Galaxy tool shed (e.g., the file name shed_tool_conf.xml whose ' @@ -1566,3 +1566,13 @@ def get_repository( trans, id ): def get_tool_dependency( trans, id ): """Get a tool_dependency from the database via id""" return trans.sa_session.query( trans.model.ToolDependency ).get( trans.security.decode_id( id ) ) +def have_shed_tool_conf_for_install( trans ): + if not trans.app.toolbox.shed_tool_confs: + return False + migrated_tools_conf_path, migrated_tools_conf_name = os.path.split( trans.app.config.migrated_tools_config ) + for shed_tool_conf_dict in trans.app.toolbox.shed_tool_confs: + shed_tool_conf = shed_tool_conf_dict[ 'config_filename' ] + shed_tool_conf_path, shed_tool_conf_name = os.path.split( shed_tool_conf ) + if shed_tool_conf_name != migrated_tools_conf_name: + return True + return False