mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-27 16:55:06 +00:00
Fixed mode test connection (#14693)
This commit is contained in:
parent
156dc29687
commit
f1049d55c4
@ -74,7 +74,6 @@ class ModeApiClient:
|
|||||||
Returns:
|
Returns:
|
||||||
dict
|
dict
|
||||||
"""
|
"""
|
||||||
try:
|
|
||||||
all_reports = []
|
all_reports = []
|
||||||
response_collections = self.client.get(f"/{workspace_name}/{COLLECTIONS}")
|
response_collections = self.client.get(f"/{workspace_name}/{COLLECTIONS}")
|
||||||
collections = response_collections[EMBEDDED]["spaces"]
|
collections = response_collections[EMBEDDED]["spaces"]
|
||||||
@ -83,14 +82,10 @@ class ModeApiClient:
|
|||||||
workspace_name=workspace_name,
|
workspace_name=workspace_name,
|
||||||
collection_token=collection.get(TOKEN),
|
collection_token=collection.get(TOKEN),
|
||||||
)
|
)
|
||||||
|
if response_reports:
|
||||||
reports = response_reports[EMBEDDED][REPORTS]
|
reports = response_reports[EMBEDDED][REPORTS]
|
||||||
all_reports.extend(reports)
|
all_reports.extend(reports)
|
||||||
return all_reports
|
return all_reports
|
||||||
except Exception as exc: # pylint: disable=broad-except
|
|
||||||
logger.debug(traceback.format_exc())
|
|
||||||
logger.warning(f"Error fetching all reports: {exc}")
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_all_reports_for_collection(
|
def get_all_reports_for_collection(
|
||||||
self, workspace_name: str, collection_token: str
|
self, workspace_name: str, collection_token: str
|
||||||
@ -180,11 +175,3 @@ class ModeApiClient:
|
|||||||
logger.warning(f"Error fetching all data sources: {exc}")
|
logger.warning(f"Error fetching all data sources: {exc}")
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_user_account(self) -> dict:
|
|
||||||
"""Method to fetch account details
|
|
||||||
Returns:
|
|
||||||
dict
|
|
||||||
"""
|
|
||||||
response = self.client.get("/account")
|
|
||||||
return response
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
"""
|
"""
|
||||||
Source connection handler
|
Source connection handler
|
||||||
"""
|
"""
|
||||||
|
from functools import partial
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from metadata.generated.schema.entity.automations.workflow import (
|
from metadata.generated.schema.entity.automations.workflow import (
|
||||||
@ -43,7 +44,11 @@ def test_connection(
|
|||||||
of a metadata workflow or during an Automation Workflow
|
of a metadata workflow or during an Automation Workflow
|
||||||
"""
|
"""
|
||||||
|
|
||||||
test_fn = {"CheckAccess": client.get_user_account}
|
test_fn = {
|
||||||
|
"CheckDashboards": partial(
|
||||||
|
client.fetch_all_reports, service_connection.workspaceName
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
test_connection_steps(
|
test_connection_steps(
|
||||||
metadata=metadata,
|
metadata=metadata,
|
||||||
|
|||||||
@ -4,9 +4,9 @@
|
|||||||
"description": "This Test Connection validates the access against the server and basic metadata extraction of dashboards and charts.",
|
"description": "This Test Connection validates the access against the server and basic metadata extraction of dashboards and charts.",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "CheckAccess",
|
"name": "CheckDashboards",
|
||||||
"description": "Validate that the API is accessible with the given credentials",
|
"description": "Validate that the Dashboards(Reports) API is accessible with the given credentials",
|
||||||
"errorMessage": "Failed to connect to mode, please validate the credentials",
|
"errorMessage": "Failed to connect to mode to get the dashboards, please validate the credentials",
|
||||||
"shortCircuit": true,
|
"shortCircuit": true,
|
||||||
"mandatory": true
|
"mandatory": true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user