From cb8536fa752ff1114f01e2e95f8e53537ffab1b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Manuel=20Dom=C3=ADnguez?= Date: Tue, 3 Sep 2024 15:07:47 +0200 Subject: [PATCH] Use `urlparse` to compare `interactivetoolsproxy_map` with `database_connection` and `install_database_connection` Using `urlparse` rather than `sqlalchemy.engine.make_url` decreases the precision of the comparison, but removes the need to declare `sqlalchemy` as a dependency of the config package. This is a tradeoff between convenience (preventing mistakes from the user) and complexity (number of dependencies of the config package). --- lib/galaxy/config/__init__.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py index eba4306839ae..899c655e69c4 100644 --- a/lib/galaxy/config/__init__.py +++ b/lib/galaxy/config/__init__.py @@ -33,7 +33,6 @@ from urllib.parse import urlparse import yaml -from sqlalchemy.engine import make_url as parse_sqlalchemy_url from galaxy.config.schema import AppSchema from galaxy.exceptions import ConfigurationError @@ -1114,7 +1113,7 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None: # ensure the database URL for the SQLAlchemy map does not match that of a Galaxy DB urls = { - setting: parse_sqlalchemy_url(value) + setting: urlparse(value) for setting, value in ( ("interactivetoolsproxy_map", self.interactivetoolsproxy_map), ("database_connection", self.database_connection), @@ -1124,7 +1123,14 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None: } def is_in_conflict(url1, url2): - return all((url1.host == url2.host, url1.port == url2.port, url1.database == url2.database)) + return all( + ( + url1.scheme == url2.scheme, + url1.hostname == url2.hostname, + url1.port == url2.port, + url1.path == url2.path + ) + ) conflicting_settings = { setting