Update logging messages for JWT tokens (#12169)

This commit is contained in:
Pere Miquel Brull 2023-06-27 12:32:08 +02:00 committed by GitHub
parent 36dd1b6b2d
commit c22c5871f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 12 deletions

View File

@ -315,8 +315,10 @@ class Workflow(WorkflowStatusMixin):
)
else:
raise InvalidWorkflowJSONException(
"The serviceConnection is not informed and we cannot retrieve it from the API"
f" by searching for the service name [{service_name}]. Does this service exist in OpenMetadata?"
f"Error getting the service [{service_name}] from the API. If it exists in OpenMetadata,"
" make sure the ingestion-bot JWT token is valid and that the Workflow is deployed"
" with the latest one. If this error persists, recreate the JWT token and"
" redeploy the Workflow."
)
except InvalidWorkflowJSONException as exc:
raise exc

View File

@ -245,8 +245,9 @@ def test_connection_steps(
if not test_connection_definition:
raise SourceConnectionException(
f"Test connection definition for {test_connection_def_fqn} not found please review the Server Configuration"
f" of the Workflow configuration. Check that the Security Configuration has been set up correctly."
f"Test connection definition for {test_connection_def_fqn} not found! Make sure the"
" ingestion-bot JWT token is valid and that the Workflow is deployed with the latest one."
" If this error persists, recreate the JWT token and redeploy the Workflow."
)
steps = [

View File

@ -83,9 +83,11 @@ class GetServiceException(Exception):
def __init__(self, service_type: str, service_name: str):
self.message = (
f"Could not get service from type {service_type}. This means that the"
f"Could not get service from type [{service_type}]. This means that the"
" OpenMetadata client running in the Airflow host had issues getting"
f" the service {service_name}. Validate your ingestion-bot authentication."
f" the service [{service_name}]. Make sure the ingestion-bot JWT token"
" is valid and that the Workflow is deployed with the latest one. If this error"
" persists, recreate the JWT token and redeploy the Workflow."
)
super().__init__(self.message)

View File

@ -17,6 +17,7 @@ from airflow import DAG
from openmetadata_managed_apis.utils.logger import set_operator_logger
from openmetadata_managed_apis.workflows.ingestion.common import (
ClientInitializationError,
GetServiceException,
build_dag,
)
from openmetadata_managed_apis.workflows.ingestion.elasticsearch_sink import (
@ -83,9 +84,7 @@ def build_data_insight_workflow_config(
)
if not openmetadata_service:
raise ValueError(
"Could not retrieve the OpenMetadata service! This should not happen."
)
raise GetServiceException(service_type="metadata", service_name="OpenMetadata")
sink = build_elasticsearch_sink(
openmetadata_service.connection.config, ingestion_pipeline

View File

@ -14,6 +14,7 @@ ElasticSearch reindex DAG function builder
from airflow import DAG
from openmetadata_managed_apis.workflows.ingestion.common import (
ClientInitializationError,
GetServiceException,
build_dag,
metadata_ingestion_workflow,
)
@ -56,9 +57,7 @@ def build_es_reindex_workflow_config(
entity=MetadataService, fqn=ingestion_pipeline.service.fullyQualifiedName
)
if not openmetadata_service:
raise ValueError(
"Could not retrieve the OpenMetadata service! This should not happen."
)
raise GetServiceException(service_type="metadata", service_name="OpenMetadata")
sink = Sink(type="metadata-rest", config={})