mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-05 07:38:26 +00:00
Fix powerbi test connection sucess with bad credentials (#19730)
This commit is contained in:
parent
0733cee6a2
commit
c43fa48d18
@ -94,7 +94,7 @@ class PowerBiApiClient:
|
|||||||
auth_response = PowerBiToken(**response_data)
|
auth_response = PowerBiToken(**response_data)
|
||||||
if not auth_response.access_token:
|
if not auth_response.access_token:
|
||||||
raise InvalidSourceException(
|
raise InvalidSourceException(
|
||||||
"Failed to generate the PowerBi access token. Please check provided config"
|
f"Failed to generate the PowerBi access token. Please check provided config {response_data}"
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info("PowerBi Access Token generated successfully")
|
logger.info("PowerBi Access Token generated successfully")
|
||||||
@ -105,19 +105,12 @@ class PowerBiApiClient:
|
|||||||
Returns:
|
Returns:
|
||||||
List[PowerBIDashboard]
|
List[PowerBIDashboard]
|
||||||
"""
|
"""
|
||||||
try:
|
if self.config.useAdminApis:
|
||||||
if self.config.useAdminApis:
|
response_data = self.client.get("/myorg/admin/dashboards")
|
||||||
response_data = self.client.get("/myorg/admin/dashboards")
|
response = DashboardsResponse(**response_data)
|
||||||
response = DashboardsResponse(**response_data)
|
return response.value
|
||||||
return response.value
|
group = self.fetch_all_workspaces()[0]
|
||||||
group = self.fetch_all_workspaces()[0]
|
return self.fetch_all_org_dashboards(group_id=group.id)
|
||||||
return self.fetch_all_org_dashboards(group_id=group.id)
|
|
||||||
|
|
||||||
except Exception as exc: # pylint: disable=broad-except
|
|
||||||
logger.debug(traceback.format_exc())
|
|
||||||
logger.warning(f"Error fetching dashboards: {exc}")
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def fetch_all_org_dashboards(
|
def fetch_all_org_dashboards(
|
||||||
self, group_id: str
|
self, group_id: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user