Skip to content

Commit 14f430c

Browse files
bartashgaallas
authored andcommitted
IMPALA-8332: Remove Impala Shell warnings part 1
In Thrift 0.9.3 the TSSLSocket initializer TSSLSocket.__init__ prints warnings if positional parameters are used. Change our usage of this initializer to use named parameters. Follow up work on "IMPALA-8333 Remove Impala Shell warnings part 2" will remove one further warning message. TESTING Ran all end-to-end tests. Added tests for the deprecation warnings to test_client_ssl.py. Change-Id: I31f9a0bb12ca6a1da9129eacd29ac105b883e01b Reviewed-on: http://gerrit.cloudera.org:8080/12837 Reviewed-by: Fredy Wijaya <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Reviewed-on: https://gerrit.sjc.cloudera.com/c/cdh/impala/+/49283 Reviewed-by: Laszlo Gaal <[email protected]> Tested-by: Jenkins User <[email protected]> Tested-by: Laszlo Gaal <[email protected]> CDH-Build: Laszlo Gaal <[email protected]> Quasar-L0: Laszlo Gaal <[email protected]>
1 parent 91500b4 commit 14f430c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

shell/TSSLSocketWithWildcardSAN.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def __init__(self,
4242
validate=True,
4343
ca_certs=None,
4444
unix_socket=None):
45-
TSSLSocket.TSSLSocket.__init__(self, host, port, validate, ca_certs, unix_socket)
45+
cert_reqs = ssl.CERT_REQUIRED if validate else ssl.CERT_NONE
46+
TSSLSocket.TSSLSocket.__init__(self, host=host, port=port, cert_reqs=cert_reqs,
47+
ca_certs=ca_certs, unix_socket=unix_socket)
4648
# Set client protocol choice to be very permissive, as we rely on servers to enforce
4749
# good protocol selection. This value is forwarded to the ssl.wrap_socket() API during
4850
# open(). See https://docs.python.org/2/library/ssl.html#socket-creation for a table

tests/custom_cluster/test_client_ssl.py

+10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ class TestClientSsl(CustomClusterTestSuite):
5353
SAN_UNSUPPORTED_ERROR = ("Certificate error with remote host: hostname "
5454
"'localhost' doesn't match u'badCN'")
5555

56+
# Deprecation warnings that should not be seen.
57+
DEPRECATED_POSITIONAL_WARNING = "positional argument is deprecated"
58+
DEPRECATED_VALIDATE_WARNING = "validate is deprecated"
59+
# TODO(IMPALA-8333) check for "DeprecationWarning"
60+
5661
SSL_WILDCARD_ARGS = ("--ssl_client_ca_certificate=%s/wildcardCA.pem "
5762
"--ssl_server_certificate=%s/wildcard-cert.pem "
5863
"--ssl_private_key=%s/wildcard-cert.key"
@@ -219,12 +224,17 @@ def _validate_positive_cases(self, ca_cert=""):
219224
result = run_impala_shell_cmd(shell_options, wait_until_connected=False)
220225
for msg in [self.SSL_ENABLED, self.CONNECTED, self.FETCHED]:
221226
assert msg in result.stderr
227+
for warning in [self.DEPRECATED_POSITIONAL_WARNING, self.DEPRECATED_VALIDATE_WARNING]:
228+
assert warning not in result.stderr
222229

223230
if ca_cert != "":
224231
shell_options = shell_options + (" --ca_cert=%s" % ca_cert)
225232
result = run_impala_shell_cmd(shell_options, wait_until_connected=False)
226233
for msg in [self.SSL_ENABLED, self.CONNECTED, self.FETCHED]:
227234
assert msg in result.stderr
235+
for warning in [self.DEPRECATED_POSITIONAL_WARNING,
236+
self.DEPRECATED_VALIDATE_WARNING]:
237+
assert warning not in result.stderr
228238

229239
def _verify_ssl_webserver(self):
230240
for port in ["25000", "25010", "25020"]:

0 commit comments

Comments
 (0)