mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-01 05:13:15 +00:00
fix(ingest/tableau): support ssl_verify flag properly (#6682)
This commit is contained in:
parent
2008130f2f
commit
acc79d7d0d
@ -176,10 +176,21 @@ class TableauConnectionConfig(ConfigModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
server = Server(self.connect_uri, use_server_version=True)
|
server = Server(
|
||||||
|
self.connect_uri,
|
||||||
|
use_server_version=True,
|
||||||
|
http_options={
|
||||||
|
# As per https://community.tableau.com/s/question/0D54T00000F33bdSAB/tableauserverclient-signin-with-ssl-certificate
|
||||||
|
"verify": bool(self.ssl_verify),
|
||||||
|
**(
|
||||||
|
{"cert": self.ssl_verify}
|
||||||
|
if isinstance(self.ssl_verify, str)
|
||||||
|
else {}
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
# From https://stackoverflow.com/a/50159273/5004662.
|
# From https://stackoverflow.com/a/50159273/5004662.
|
||||||
server._session.verify = self.ssl_verify
|
|
||||||
server._session.trust_env = False
|
server._session.trust_env = False
|
||||||
|
|
||||||
server.auth.sign_in(authentication)
|
server.auth.sign_in(authentication)
|
||||||
|
@ -8,7 +8,7 @@ from freezegun import freeze_time
|
|||||||
from tableauserverclient.models import ViewItem
|
from tableauserverclient.models import ViewItem
|
||||||
|
|
||||||
from datahub.configuration.source_common import DEFAULT_ENV
|
from datahub.configuration.source_common import DEFAULT_ENV
|
||||||
from datahub.ingestion.run.pipeline import Pipeline
|
from datahub.ingestion.run.pipeline import Pipeline, PipelineContext
|
||||||
from datahub.ingestion.source.state.checkpoint import Checkpoint
|
from datahub.ingestion.source.state.checkpoint import Checkpoint
|
||||||
from datahub.ingestion.source.state.tableau_state import TableauCheckpointState
|
from datahub.ingestion.source.state.tableau_state import TableauCheckpointState
|
||||||
from datahub.ingestion.source.tableau import TableauSource
|
from datahub.ingestion.source.tableau import TableauSource
|
||||||
@ -386,3 +386,25 @@ def test_tableau_stateful(pytestconfig, tmp_path, mock_time, mock_datahub_graph)
|
|||||||
"urn:li:dashboard:(tableau,39b7a1de-6276-cfc7-9b59-1d22f3bbb06b)",
|
"urn:li:dashboard:(tableau,39b7a1de-6276-cfc7-9b59-1d22f3bbb06b)",
|
||||||
]
|
]
|
||||||
assert sorted(deleted_dashboard_urns) == sorted(difference_dashboard_urns)
|
assert sorted(deleted_dashboard_urns) == sorted(difference_dashboard_urns)
|
||||||
|
|
||||||
|
|
||||||
|
def test_tableau_no_verify():
|
||||||
|
# This test ensures that we can connect to a self-signed certificate
|
||||||
|
# when ssl_verify is set to False.
|
||||||
|
|
||||||
|
source = TableauSource.create(
|
||||||
|
{
|
||||||
|
"connect_uri": "https://self-signed.badssl.com/",
|
||||||
|
"ssl_verify": False,
|
||||||
|
"site": "bogus",
|
||||||
|
# Credentials
|
||||||
|
"username": "bogus",
|
||||||
|
"password": "bogus",
|
||||||
|
},
|
||||||
|
PipelineContext(run_id="0"),
|
||||||
|
)
|
||||||
|
list(source.get_workunits())
|
||||||
|
|
||||||
|
report = source.get_report().as_string()
|
||||||
|
assert "SSL" not in report
|
||||||
|
assert "Unable to login" in report
|
||||||
|
Loading…
x
Reference in New Issue
Block a user