commit/galaxy-central: dan: More graceful handling of uninstalling or deactivating toolshed repositories that have already been removed from disk.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/81110680ad98/ changeset: 81110680ad98 user: dan date: 2012-10-16 17:44:20 summary: More graceful handling of uninstalling or deactivating toolshed repositories that have already been removed from disk. affected #: 1 file diff -r 1425614da4ea5eb4011f8176eb8afbb4a4dea6a1 -r 81110680ad9886085dca4d052f52e196e8ed782e lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -314,11 +314,15 @@ repository_clone_url = self.__generate_clone_url( trans, repository ) repository.deleted = False repository.status = trans.model.ToolShedRepository.installation_status.INSTALLED - trans.sa_session.add( repository ) - trans.sa_session.flush() if repository.includes_tools: metadata = repository.metadata - repository_tools_tups = get_repository_tools_tups( trans.app, metadata ) + try: + repository_tools_tups = get_repository_tools_tups( trans.app, metadata ) + except Exception, e: + error = "Error activating repository %s: %s" % ( repository.name, str( e ) ) + log.debug( error ) + return trans.show_error_message( '%s.<br/>You may be able to resolve this by uninstalling and then reinstalling the repository. Click <a href="%s">here</a> to uninstall the repository.' + % ( error, web.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) ) ) ) # Reload tools into the appropriate tool panel section. tool_panel_dict = repository.metadata[ 'tool_panel_section' ] add_to_tool_panel( trans.app, @@ -330,6 +334,8 @@ shed_tool_conf, tool_panel_dict, new_install=False ) + trans.sa_session.add( repository ) + trans.sa_session.flush() if repository.includes_datatypes: repository_install_dir = os.path.abspath ( relative_install_dir ) # Deactivate proprietary datatypes. @@ -476,7 +482,11 @@ removed = True except Exception, e: log.debug( "Error removing repository installation directory %s: %s" % ( str( repository_install_dir ), str( e ) ) ) - removed = False + if isinstance( e, OSError ) and not os.path.exists( repository_install_dir ): + removed = True + log.debug( "Repository directory does not exist on disk, marking as uninstalled." ) + else: + removed = False if removed: tool_shed_repository.uninstalled = True # Remove all installed tool dependencies. 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.
participants (1)
-
Bitbucket