From 98b7b120b564265c029d5fa40b4cb7105d1e214a Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 13 Jan 2022 13:39:05 +0100 Subject: [PATCH] Fix metadata source access in tool shed Fixes: ``` Unexpected HTTP status code: 500: {"err_msg": "Metadata may have been defined for some items in revision '8f1b150a2487'. Correct the following problems if necessary and reset metadata.
abyss-pe.xml<\/b> - 'NoneType' object has no attribute 'get_biotools_metadata'
"} ``` in https://github.com/galaxyproject/tools-iuc/runs/4792653893?check_suite_focus=true --- lib/galaxy/tools/__init__.py | 5 +++-- test/unit/unittest_utils/galaxy_mock.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index f2af91aa26a..d3277abfbda 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1022,8 +1022,9 @@ class Tool(Dictifiable): has_missing_data = len(edam_operations) == 0 or len(edam_topics) == 0 if has_missing_data: biotools_reference = self.biotools_reference - if biotools_reference: - biotools_entry = self.app.biotools_metadata_source.get_biotools_metadata(biotools_reference) + metadata_source = self.app.biotools_metadata_source + if biotools_reference and metadata_source: + biotools_entry = metadata_source.get_biotools_metadata(biotools_reference) if biotools_entry: edam_info = biotools_entry.edam_info if len(edam_operations) == 0: diff --git a/test/unit/unittest_utils/galaxy_mock.py b/test/unit/unittest_utils/galaxy_mock.py index 2e50ed279f5..381bbb57c7a 100644 --- a/test/unit/unittest_utils/galaxy_mock.py +++ b/test/unit/unittest_utils/galaxy_mock.py @@ -103,6 +103,7 @@ class MockApp(di.Container): self.user_manager = UserManager(self) self.execution_timer_factory = Bunch(get_timer=StructuredExecutionTimer) self.is_job_handler = False + self.biotools_metadata_source = None rebind_container_to_task(self) def url_for(*args, **kwds):