Skip to content

Commit

Permalink
Merge pull request #491 from openvinotoolkit/demo-day-2.4
Browse files Browse the repository at this point in the history
Improve error message when logging on to old Geti instances
  • Loading branch information
ljcornel authored Sep 3, 2024
2 parents d265217 + ec1d92b commit f757b1a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion geti_sdk/geti.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _check_platform_version(self) -> None:
f"The Intel® Geti™ server version {platform_version} is newer than "
f"the Geti SDK version {self.sdk_version}. Some features may not be "
"supported and you may encounter errors.\n"
"Please update the Intel Geti SDK to the latest version"
"Please update the Intel Geti SDK to the latest version "
"with `pip install --upgrade geti-sdk`."
)
# Check if the platform version is older than the last supported version
Expand Down
24 changes: 18 additions & 6 deletions geti_sdk/http_session/geti_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,15 @@ def platform_serving_mode(self) -> str:
"""
Return the type of the GETi platform service.
"""
deployment_config_response = self.request(
url=f"{self.config.host}/deployment-config.json",
method="GET",
proxies=self._proxies,
).json()
serving_mode = deployment_config_response.get("servingMode").lower()
try:
deployment_config_response = self.request(
url=f"{self.config.host}/deployment-config.json",
method="GET",
proxies=self._proxies,
).json()
serving_mode = deployment_config_response.get("servingMode").lower()
except requests.exceptions.JSONDecodeError:
return ONPREM_MODE
if serving_mode == "on-prem":
return ONPREM_MODE
elif serving_mode == "saas":
Expand Down Expand Up @@ -605,6 +608,15 @@ def _handle_dex_response(self, response: Response) -> None:
"The cluster responded to the request, but authentication failed. "
"Please verify that you have provided correct credentials."
)
elif response.status_code == 404:
raise ValueError(
"Unable to authenticate with the Intel Geti server. The authentication "
"mechanism you are trying to use is no longer supported. This error "
"indicates that the Intel® Geti™ server version is not supported by "
"this version of the Intel Geti SDK package. Please update the "
"Intel® Geti™ server to version 2.0 or later, or use a previous "
"version of the SDK."
)
else:
raise GetiRequestException(
method=response.request.method,
Expand Down

0 comments on commit f757b1a

Please sign in to comment.