def uninstall_repository(self, trans, id=None, **kwd): """ DELETE /api/tool_shed_repositories/id DELETE /api/tool_shed_repositories/ :param id: encoded repository id. Either id or name, owner, changeset_revision and tool_shed_url need to be supplied :param kwd: 'remove_from_disk': Remove repository from disk or deactivate repository. Defaults to `True` (= remove repository from disk). 'name': Repository name 'owner': Repository owner 'changeset_revision': Changeset revision to uninstall 'tool_shed_url': Tool Shed URL """ remove_from_disk = util.asbool(kwd.get('remove_from_disk', True)) if id: try: repository = get_tool_shed_repository_by_id(self.app, id) except ValueError: raise HTTPBadRequest( detail="No repository with id '%s' found" % id) else: tsr_arguments = [ 'name', 'owner', 'changeset_revision', 'tool_shed_url' ] try: tsr_arguments = {key: kwd[key] for key in tsr_arguments} except KeyError as e: raise HTTPBadRequest(detail="Missing required parameter '%s'" % e.args[0]) repository = get_installed_repository( app=self.app, tool_shed=tsr_arguments['tool_shed_url'], name=tsr_arguments['name'], owner=tsr_arguments['owner'], changeset_revision=tsr_arguments['changeset_revision']) if not repository: raise HTTPBadRequest(detail="Repository not found") irm = InstalledRepositoryManager(app=self.app) errors = irm.uninstall_repository(repository=repository, remove_from_disk=remove_from_disk) if not errors: action = 'removed' if remove_from_disk else 'deactivated' return { 'message': f'The repository named {repository.name} has been {action}.' } else: raise Exception( f'Attempting to uninstall tool dependencies for repository named {repository.name} resulted in errors: {errors}' )
def show(self, trans, id, **kwd): """ GET /api/tool_shed_repositories/{encoded_tool_shed_repsository_id} Display a dictionary containing information about a specified tool_shed_repository. .. code-block:: { id: (string) Galaxy ID status: (string) Installation status name: (string) Repository name deleted: (bool) Repository deleted ctx_rev: (int) Changeset revision number (0, 1, 2...) error_message: (string) Installation error message installed_changeset_revision: (string) Initially installed changeset revision. Used to construct path to repository within Galaxies filesystem. Does not change if a repository is updated. tool_shed: (string) Repository toolshed hostname dist_to_shed: (bool) url: (string) API url of repository uninstalled: (bool) Tool has been uninstalled owner: (string) Repository owner within toolshed changeset_revision: (string) Changeset revision of repository include_datatypes: (bool) Repository includes installed datatypes tool_shed_status: (dict) See https://github.com/galaxyproject/galaxy/issues/10453 latest_installable_revision: (string) Most recent version available on toolshed revision_update: (string) revision_upgrade: (string) repository_deprecated: (string) Repository has been depreciated } :param id: the encoded id of the ToolShedRepository object """ # Example URL: http://localhost:8763/api/tool_shed_repositories/df7a1f0c02a5b08e tool_shed_repository = get_tool_shed_repository_by_id(self.app, id) if tool_shed_repository is None: log.debug( "Unable to locate tool_shed_repository record for id %s." % (str(id))) return {} tool_shed_repository_dict = tool_shed_repository.as_dict( value_mapper=self.__get_value_mapper(trans, tool_shed_repository)) tool_shed_repository_dict['url'] = url_for( controller='tool_shed_repositories', action='show', id=trans.security.encode_id(tool_shed_repository.id)) return tool_shed_repository_dict
def show(self, trans, id, **kwd): """ GET /api/tool_shed_repositories/{encoded_tool_shed_repsository_id} Display a dictionary containing information about a specified tool_shed_repository. :param id: the encoded id of the ToolShedRepository object """ # Example URL: http://localhost:8763/api/tool_shed_repositories/df7a1f0c02a5b08e tool_shed_repository = get_tool_shed_repository_by_id(self.app, id) if tool_shed_repository is None: log.debug( "Unable to locate tool_shed_repository record for id %s." % (str(id))) return {} tool_shed_repository_dict = tool_shed_repository.as_dict( value_mapper=self.__get_value_mapper(trans, tool_shed_repository)) tool_shed_repository_dict['url'] = url_for( controller='tool_shed_repositories', action='show', id=trans.security.encode_id(tool_shed_repository.id)) return tool_shed_repository_dict