mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 15:32:25 +00:00
Revert: remove Gettokens (#18908)
* Revert: remove Gettokens * test_conn_fixes
This commit is contained in:
parent
d634edb8f1
commit
cf61df2404
@ -152,24 +152,27 @@ class MSTRClient:
|
|||||||
def is_project_name(self) -> bool:
|
def is_project_name(self) -> bool:
|
||||||
return bool(self.config.projectName)
|
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]:
|
def get_projects_list(self) -> List[MstrProject]:
|
||||||
"""
|
"""
|
||||||
Get List of all projects
|
Get List of all projects
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
resp_projects = self.client.get(
|
project_list = MstrProjectList(projects=self.list_projects())
|
||||||
path="/projects",
|
|
||||||
)
|
|
||||||
|
|
||||||
project_list = MstrProjectList(projects=resp_projects)
|
|
||||||
return project_list.projects
|
return project_list.projects
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.debug(traceback.format_exc())
|
logger.debug(traceback.format_exc())
|
||||||
logger.warning(f"Failed to fetch the project list due to [{exc}]")
|
logger.warning(f"Failed to fetch the project list due to [{exc}]")
|
||||||
|
|
||||||
return []
|
|
||||||
|
|
||||||
def get_project_by_name(self) -> Optional[MstrProject]:
|
def get_project_by_name(self) -> Optional[MstrProject]:
|
||||||
"""
|
"""
|
||||||
Get Project By Name
|
Get Project By Name
|
||||||
|
|||||||
@ -49,8 +49,7 @@ def test_connection(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
test_fn = {
|
test_fn = {
|
||||||
"GetToken": client.get_auth_params,
|
"GetProjects": client.list_projects,
|
||||||
"GetProjects": client.get_projects_list,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return test_connection_steps(
|
return test_connection_steps(
|
||||||
|
|||||||
@ -3,13 +3,6 @@
|
|||||||
"displayName": "Mstr Test Connection",
|
"displayName": "Mstr Test Connection",
|
||||||
"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": "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",
|
"name": "GetProjects",
|
||||||
"description": "List all the projects available to the user",
|
"description": "List all the projects available to the user",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user