Skip to content

Commit 6b3bdfa

Browse files
Akhil Lawrencerccern
authored andcommitted
add configs for name node protocol and validate cert
1 parent adb5432 commit 6b3bdfa

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

HdfsBrowser/hdfsbrowser/serverextension.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import traceback
55

6-
from traitlets import Unicode, Long, Float
6+
from traitlets import Unicode, Long, Float, Bool
77
from traitlets.config import Configurable
88

99
from notebook.utils import url_path_join
@@ -53,6 +53,8 @@ class HDFSBrowserConfig(Configurable):
5353
2, config=True, help='Do not wait for connection longer than this value'
5454
)
5555

56+
validate_cert = Bool(True, config=True, help='Validate SSL or not')
57+
5658

5759
class HDFSBrowserProxy(IPythonHandler):
5860

@@ -103,7 +105,11 @@ def prepare(self):
103105

104106
try:
105107
response = yield AsyncHTTPClient().fetch(
106-
HTTPRequest(nmd_active_url, connect_timeout=1),
108+
HTTPRequest(
109+
nmd_active_url,
110+
connect_timeout=self.hdfs_browser_config.connection_timeout,
111+
validate_cert=self.hdfs_browser_config.validate_cert
112+
),
107113
raise_error=False
108114
)
109115
except Exception:
@@ -157,7 +163,8 @@ def get(self):
157163
header_callback=self.handle_webhdfs_stream_header,
158164
streaming_callback=self.handle_webhdfs_stream_chunk,
159165
request_timeout=self.hdfs_browser_config.webhdfs_response_timeout,
160-
connect_timeout=self.hdfs_browser_config.connection_timeout),
166+
connect_timeout=self.hdfs_browser_config.connection_timeout,
167+
validate_cert=self.hdfs_browser_config.validate_cert),
161168
raise_error=False
162169
)
163170
self.handle_webhdfs_stream_finish()
@@ -166,7 +173,8 @@ def get(self):
166173
explorer_response = yield AsyncHTTPClient().fetch(
167174
HTTPRequest(
168175
url=hdfs_browser_url,
169-
connect_timeout=self.hdfs_browser_config.connection_timeout)
176+
connect_timeout=self.hdfs_browser_config.connection_timeout,
177+
validate_cert=self.hdfs_browser_config.validate_cert)
170178
,
171179
raise_error=False
172180
)

0 commit comments

Comments
 (0)