diff --git a/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py b/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py index 64fbd912a86..7d37f7a6a2a 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py @@ -152,24 +152,27 @@ class MSTRClient: def is_project_name(self) -> bool: return bool(self.config.projectName) + def list_projects(self) -> List[MstrProject]: + """ + Test if we can get the token and fetch projects + """ + self.get_auth_params() + resp_projects = self.client.get( + path="/projects", + ) + return resp_projects + def get_projects_list(self) -> List[MstrProject]: """ Get List of all projects """ try: - resp_projects = self.client.get( - path="/projects", - ) - - project_list = MstrProjectList(projects=resp_projects) + project_list = MstrProjectList(projects=self.list_projects()) return project_list.projects - except Exception as exc: logger.debug(traceback.format_exc()) logger.warning(f"Failed to fetch the project list due to [{exc}]") - return [] - def get_project_by_name(self) -> Optional[MstrProject]: """ Get Project By Name diff --git a/ingestion/src/metadata/ingestion/source/dashboard/mstr/connection.py b/ingestion/src/metadata/ingestion/source/dashboard/mstr/connection.py index 9e9618b8619..4c5682f8ee5 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/mstr/connection.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/mstr/connection.py @@ -49,8 +49,7 @@ def test_connection( """ test_fn = { - "GetToken": client.get_auth_params, - "GetProjects": client.get_projects_list, + "GetProjects": client.list_projects, } return test_connection_steps( diff --git a/openmetadata-service/src/main/resources/json/data/testConnections/dashboard/mstr.json b/openmetadata-service/src/main/resources/json/data/testConnections/dashboard/mstr.json index 93c83560efc..b6e5a2a25e5 100644 --- a/openmetadata-service/src/main/resources/json/data/testConnections/dashboard/mstr.json +++ b/openmetadata-service/src/main/resources/json/data/testConnections/dashboard/mstr.json @@ -3,13 +3,6 @@ "displayName": "Mstr Test Connection", "description": "This Test Connection validates the access against the server and basic metadata extraction of dashboards and charts.", "steps": [ - { - "name": "GetToken", - "description": "Fetch the Auth Token", - "errorMessage": "Failed to fetch auth token, please validate the credentials or if user has access to fetch token or if you are using the correct login mode", - "shortCircuit": true, - "mandatory": true - }, { "name": "GetProjects", "description": "List all the projects available to the user",