1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f7416872890b/ Changeset: f7416872890b User: Dave Bouvier Date: 2013-10-14 22:46:41 Summary: Explicitly uninstall tool dependencies that are in an error state. Affected #: 2 files diff -r 2b92d545d02e6db34ce6459fa5d7b681d61021d6 -r f7416872890b78201d622746261a7ff34e915932 test/install_and_test_tool_shed_repositories/base/test_db_util.py --- a/test/install_and_test_tool_shed_repositories/base/test_db_util.py +++ b/test/install_and_test_tool_shed_repositories/base/test_db_util.py @@ -8,39 +8,59 @@ def delete_obj( obj ): sa_session.delete( obj ) sa_session.flush() + def delete_user_roles( user ): for ura in user.roles: sa_session.delete( ura ) sa_session.flush() + def flush( obj ): sa_session.add( obj ) sa_session.flush() + def get_repository( repository_id ): return sa_session.query( model.ToolShedRepository ) \ .filter( model.ToolShedRepository.table.c.id == repository_id ) \ .first() + def get_installed_repository_by_name_owner_changeset_revision( name, owner, changeset_revision ): return sa_session.query( model.ToolShedRepository ) \ .filter( and_( model.ToolShedRepository.table.c.name == name, model.ToolShedRepository.table.c.owner == owner, model.ToolShedRepository.table.c.installed_changeset_revision == changeset_revision ) ) \ .one() + def get_private_role( user ): for role in user.all_roles(): if role.name == user.email and role.description == 'Private Role for %s' % user.email: return role raise AssertionError( "Private role not found for user '%s'" % user.email ) + +def get_tool_dependencies_for_installed_repository( repository_id, status=None ): + if status is not None: + return sa_session.query( model.ToolDependency ) \ + .filter( and_( model.ToolDependency.table.c.tool_shed_repository_id == repository_id, + model.ToolDependency.table.c.status == status ) ) \ + .all() + else: + return sa_session.query( model.ToolDependency ) \ + .filter( model.ToolDependency.table.c.tool_shed_repository_id == repository_id ) \ + .all() + def mark_obj_deleted( obj ): obj.deleted = True sa_session.add( obj ) sa_session.flush() + def refresh( obj ): sa_session.refresh( obj ) + def get_private_role( user ): for role in user.all_roles(): if role.name == user.email and role.description == 'Private Role for %s' % user.email: return role raise AssertionError( "Private role not found for user '%s'" % user.email ) + def get_user( email ): return sa_session.query( model.User ) \ .filter( model.User.table.c.email==email ) \ diff -r 2b92d545d02e6db34ce6459fa5d7b681d61021d6 -r f7416872890b78201d622746261a7ff34e915932 test/install_and_test_tool_shed_repositories/base/twilltestcase.py --- a/test/install_and_test_tool_shed_repositories/base/twilltestcase.py +++ b/test/install_and_test_tool_shed_repositories/base/twilltestcase.py @@ -149,4 +149,20 @@ strings_displayed.append( 'has been deactivated' ) else: strings_displayed.append( 'has been uninstalled' ) - self.check_for_strings( strings_displayed, strings_not_displayed=[] ) \ No newline at end of file + self.check_for_strings( strings_displayed, strings_not_displayed=[] ) + # Get all tool dependencies that are in an error state and uninstall them explicitly, so that the next installation attempt + # may succeed. + error_state = model.ToolDependency.installation_status.ERROR + tool_dependencies = test_db_util.get_tool_dependencies_for_installed_repository( installed_repository.id, status=error_state ) + if len( tool_dependencies ) > 0: + encoded_tool_dependency_ids = [ self.security.encode_id( tool_dependency.id ) for tool_dependency in tool_dependencies ] + self.uninstall_tool_dependencies( self.security.encode_id( installed_repository.id ), encoded_tool_dependency_ids ) + + def uninstall_tool_dependencies( self, encoded_repository_id, encoded_tool_dependency_ids ): + tool_dependency_ids = ','.join( encoded_tool_dependency_ids ) + url = '/admin_toolshed/uninstall_tool_dependencies?repository_id=%s&inst_td_ids=%s&operation=uninstall' % \ + ( encoded_repository_id, tool_dependency_ids ) + self.visit_url( url ) + tc.fv( 'uninstall_tool_dependencies', 'tool_dependency_ids', tool_dependency_ids ) + tc.submit( 'uninstall_tool_dependencies_button' ) + \ No newline at end of file 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.