From ad758c080259970c9ea587fd8dd3f56d1dab7722 Mon Sep 17 00:00:00 2001 From: Antonio Rivero Martinez <38889534+Antonio-RiveroMartnez@users.noreply.github.com> Date: Wed, 18 Jan 2023 00:11:41 -0300 Subject: [PATCH] feat(ssh_tunnel): Rename allow_ssh_tunneling and change the default value to False (#22723) --- .../data/database/DatabaseModal/index.test.tsx | 18 +++++++++--------- .../CRUD/data/database/DatabaseModal/index.tsx | 6 +++--- .../src/views/CRUD/data/database/types.ts | 2 +- superset/databases/api.py | 2 +- superset/db_engine_specs/athena.py | 1 + superset/db_engine_specs/base.py | 6 +++--- superset/db_engine_specs/bigquery.py | 1 + superset/db_engine_specs/gsheets.py | 1 + superset/db_engine_specs/postgres.py | 1 - tests/integration_tests/databases/api_tests.py | 16 ++++++++-------- 10 files changed, 28 insertions(+), 26 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx index 8457d8d17..9542450f4 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx @@ -139,7 +139,7 @@ fetchMock.mock(AVAILABLE_DB_ENDPOINT, { 'postgresql://user:password@host:port/dbname[?key=value&key=value...]', engine_information: { supports_file_upload: true, - allow_ssh_tunneling: true, + disable_ssh_tunneling: false, }, }, { @@ -149,7 +149,7 @@ fetchMock.mock(AVAILABLE_DB_ENDPOINT, { preferred: true, engine_information: { supports_file_upload: true, - allow_ssh_tunneling: false, + disable_ssh_tunneling: false, }, }, { @@ -202,7 +202,7 @@ fetchMock.mock(AVAILABLE_DB_ENDPOINT, { 'mysql://user:password@host:port/dbname[?key=value&key=value...]', engine_information: { supports_file_upload: true, - allow_ssh_tunneling: false, + disable_ssh_tunneling: false, }, }, { @@ -212,7 +212,7 @@ fetchMock.mock(AVAILABLE_DB_ENDPOINT, { preferred: true, engine_information: { supports_file_upload: true, - allow_ssh_tunneling: true, + disable_ssh_tunneling: false, }, }, { @@ -222,7 +222,7 @@ fetchMock.mock(AVAILABLE_DB_ENDPOINT, { preferred: false, engine_information: { supports_file_upload: true, - allow_ssh_tunneling: false, + disable_ssh_tunneling: false, }, }, { @@ -247,7 +247,7 @@ fetchMock.mock(AVAILABLE_DB_ENDPOINT, { sqlalchemy_uri_placeholder: 'bigquery://{project_id}', engine_information: { supports_file_upload: true, - allow_ssh_tunneling: false, + disable_ssh_tunneling: true, }, }, { @@ -258,7 +258,7 @@ fetchMock.mock(AVAILABLE_DB_ENDPOINT, { preferred: false, engine_information: { supports_file_upload: false, - allow_ssh_tunneling: false, + disable_ssh_tunneling: true, }, }, { @@ -1925,7 +1925,7 @@ describe('dbReducer', () => { payload: { engine_information: { supports_file_upload: true, - allow_ssh_tunneling: true, + disable_ssh_tunneling: false, }, ...db, driver: db.driver, @@ -1940,7 +1940,7 @@ describe('dbReducer', () => { configuration_method: db.configuration_method, engine_information: { supports_file_upload: true, - allow_ssh_tunneling: true, + disable_ssh_tunneling: false, }, driver: db.driver, expose_in_sqllab: true, diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 39f6c1587..5f85ae098 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -545,12 +545,12 @@ const DatabaseModal: FunctionComponent = ({ const sslForced = isFeatureEnabled( FeatureFlag.FORCE_DATABASE_CONNECTIONS_SSL, ); - const engineAllowsSSHTunneling = ( + const disableSSHTunnelingForEngine = ( availableDbs?.databases?.find( (DB: DatabaseObject) => DB.backend === db?.engine || DB.engine === db?.engine, ) as DatabaseObject - )?.engine_information?.allow_ssh_tunneling; + )?.engine_information?.disable_ssh_tunneling; const sshTunneling = isFeatureEnabled(FeatureFlag.SSH_TUNNELING); const hasAlert = connectionAlert || !!(db?.engine && engineSpecificAlertMapping[db.engine]); @@ -1495,7 +1495,7 @@ const DatabaseModal: FunctionComponent = ({ testConnection={testConnection} testInProgress={testInProgress} > - {sshTunneling && engineAllowsSSHTunneling && ( + {sshTunneling && !disableSSHTunnelingForEngine && (