Skip to content

Commit 0296117

Browse files
authored
Move tunneling CLI changes from master to dev mode (#424)
* revert tunneling changes, keep tox split * keep whitespace and tox-related split
1 parent e9eee40 commit 0296117

20 files changed

Lines changed: 10 additions & 1117 deletions

File tree

databricks_cli/clusters/cli.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2121
# See the License for the specific language governing permissions and
2222
# limitations under the License.
23-
import sys
2423
import time
2524
from datetime import datetime
2625
from json import loads as json_loads
@@ -331,41 +330,6 @@ def cluster_events_cli(api_client, cluster_id, start_time, end_time, order, even
331330
click.echo(tabulate(_cluster_events_to_table(events_json), tablefmt='plain'))
332331

333332

334-
@click.command(context_settings=CONTEXT_SETTINGS)
335-
@click.option('--cluster-id', cls=OneOfOption, one_of=CLUSTER_OPTIONS,
336-
type=ClusterIdClickType(), default=None, help=ClusterIdClickType.help)
337-
@click.option('--cluster-name', cls=OneOfOption, one_of=CLUSTER_OPTIONS,
338-
type=ClusterIdClickType(), default=None, help=ClusterIdClickType.help)
339-
@click.option('--local-port', type=click.INT,
340-
help="The local port to use for the local tunneling server")
341-
@click.option('--debug', '-d', is_flag=True, help="Run the tunnel in debug mode")
342-
@profile_option
343-
@eat_exceptions
344-
@provide_api_client
345-
def tunnel_cli(api_client, cluster_id, cluster_name, local_port, debug):
346-
"""
347-
[Alpha] Start a secure TCP tunnel to a cluster over Databricks' identity proxy.
348-
"""
349-
if sys.version_info < (3, 6):
350-
raise RuntimeError("The tunneling command is not supported on Python version < 3.6")
351-
if not api_client.token:
352-
raise RuntimeError("The tunneling cli only supports personal token authentication.")
353-
354-
if cluster_id:
355-
pass
356-
elif cluster_name:
357-
cluster = ClusterApi(api_client).get_cluster_by_name(cluster_name)
358-
cluster_id = cluster["cluster_id"]
359-
else:
360-
raise RuntimeError('cluster_name and cluster_id must not be empty!')
361-
362-
# TODO(tunneling-cli): move this up once we support python3 only
363-
from databricks_cli.tunnel.api import TunnelApi
364-
365-
click.echo("Starting a secure tunnel to cluster with ID: {}...".format(cluster_id))
366-
TunnelApi(api_client, cluster_id, debug=debug).start_tunneling(local_port=local_port)
367-
368-
369333
@click.group(context_settings=CONTEXT_SETTINGS,
370334
short_help='Utility to interact with Databricks clusters.')
371335
@click.option('--version', '-v', is_flag=True, callback=print_version_callback,
@@ -393,4 +357,3 @@ def clusters_group(): # pragma: no cover
393357
clusters_group.add_command(spark_versions_cli, name='spark-versions')
394358
clusters_group.add_command(permanent_delete_cli, name='permanent-delete')
395359
clusters_group.add_command(cluster_events_cli, name='events')
396-
clusters_group.add_command(tunnel_cli, name='tunnel')

databricks_cli/commands/__init__.py

Whitespace-only changes.

databricks_cli/commands/api.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

databricks_cli/sdk/api_client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,14 @@ def __init__(self, user=None, password=None, host=None, token=None,
104104
self.verify = verify
105105
self.api_version = api_version
106106
self.jobs_api_version = jobs_api_version
107-
self.host = host
108-
self.token = token
109107

110108
def close(self):
111109
"""Close the client"""
112110
pass
113111

114112
# helper functions starting here
115113

116-
def perform_query(self, method, path, data={}, headers=None, files=None, version=None,
117-
return_raw_response=False):
114+
def perform_query(self, method, path, data = {}, headers = None, files=None, version=None):
118115
"""set up connection and perform query"""
119116
if headers is None:
120117
headers = self.default_headers
@@ -147,8 +144,6 @@ def perform_query(self, method, path, data={}, headers=None, files=None, version
147144
except ValueError:
148145
pass
149146
raise requests.exceptions.HTTPError(message, response=e.response)
150-
if return_raw_response:
151-
return resp
152147
return resp.json()
153148

154149

databricks_cli/sdk/v1_service.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

databricks_cli/sdk/version.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
# limitations under the License.
2323

2424
API_VERSION = '2.0'
25-
OLD_API_VERSION = '1.2'
2625

2726
# Available API versions
2827
API_VERSIONS = ['2.0', '2.1']

databricks_cli/tunnel/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)