Skip to content
Snippets Groups Projects
Commit 46538a00 authored by Daniel Nemergut's avatar Daniel Nemergut
Browse files

Fixing a logic error in get_version by simply calling get_versions and...

Fixing a logic error in get_version by simply calling get_versions and returning the recommended version
parent df509204
No related branches found
No related tags found
2 merge requests!1706merge 2.8.4 to main,!1670WS-1405 CASA matrix service
Pipeline #15990 passed
......@@ -211,7 +211,6 @@ class CasaMatrixService(CasaMatrixServiceIF):
:return: True if the given version is cluster compatible and valid for use with the given capability
"""
result = self.session.query(CasaMatrixCasaVersion).filter_by(casa_version=version).first()
return bool(result and result.is_cluster_compatible and capability in result.capabilities)
def get_version(
......@@ -231,25 +230,8 @@ class CasaMatrixService(CasaMatrixServiceIF):
:param telescope: (Optional) The telescope to distinguish a fallback value from CAPO
:return: A dict mapping a CASA version to its path
"""
default_version = self.get_default_version(capability, telescope)
if not version:
return default_version
# Installed versions are a flat list of dicts containing version names and paths
self.installed_versions = self.find_installed_versions()
installed_version = self.get_installed_version(version)
# If the requested version is empty/invalid or doesn't exist in the installed versions, then return the default
if not installed_version:
logger.info(f"CASA version {version} is not installed, returning default version for {capability}")
return default_version
# Keep in mind the table stores the installed CASA version name, not what we're given here
elif not self.is_allowed(os.path.basename(installed_version["path"]), capability):
logger.info(f"CASA version {version} is not allowed, returning default version for {capability}")
return default_version
else:
return installed_version
versions = self.get_versions(version, capability, telescope)
return versions[0] if versions else {}
def get_versions(
self,
......@@ -286,7 +268,7 @@ class CasaMatrixService(CasaMatrixServiceIF):
else:
versions.append(installed_version)
logger.info(f"Found CASA versions for {capability}: {versions}")
logger.debug(f"Found CASA versions for {capability}: {versions}")
return versions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment