Removes deprecated ImpalaHttpClient constructor that supported port and
path as it has been deprecated since at least 2020 and appears unused.
Removes cert_file and key_file as they were also never used, and if
required must now be passed in via ssl_context.
Updates TSSLSocket fixes for Thrift 0.16 and Python 3.12. _validate_cert
was removed by Thrift 0.16, but everything worked because Thrift used
ssl.match_hostname instead. With Python 3.12 ssl.match_hostname no
longer exists so we rely on OpenSSL to handle verification with
ssl.PROTOCOL_TLS_CLIENT.
Only uses ssl.PROTOCOL_TLS_CLIENT when match_hostname is unavailable to
avoid changing existing behavior. THRIFT-792 identifies that TSocket
suppresses connection errors, where we would otherwise see SSL hostname
verification errors like
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: IP address mismatch, certificate is not
valid for '::1'. (_ssl.c:1131)
Python 2.7.9 and 3.2 are minimum required versions; both have been EOL
for several years.
Testing:
- ran custom_cluster/{test_client_ssl.py,test_ipv6.py} on Ubuntu 24 with
Python 3.12, OpenSSL 3.0.13.
- ran custom_cluster/test_client_ssl.py on RHEL 7.9 with Python 2.7.5
and Python 3.6.8, OpenSSL 1.0.2k-fips.
- adds test that hostname checking is configured.
Change-Id: I046a9010ac4cb1f7d705935054b306cddaf8bdc7
Reviewed-on: http://gerrit.cloudera.org:8080/23519
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Csaba Ringhofer <csringhofer@cloudera.com>
In Impala we use 2 spaces for indentation, however for continuation
lines we use 4 spaces (or more if it makes the code look nicer).
This violates Flake8's rule E126 which generates noise during
code reviews.
This patch adds E126 to the list of ignored rules.
Change-Id: I1beb76feed90ee524d5c2c27487561891958e54c
Reviewed-on: http://gerrit.cloudera.org:8080/18836
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Michael Smith <michael.smith@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Updates flake8 to the latest Python 2-compatible version so we can use
indent-size=2. Our code uses 2-space indents and we have previously
worked around or disabled flake8 checks that rely on 4-space indenting.
Change-Id: Ia701f6e3d86be451ae86d041b799c8a10aee2d93
Reviewed-on: http://gerrit.cloudera.org:8080/18669
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
PEP8 now reads that breaking before or after binary operators is fine,
and gives the rationale:
But this can hurt readability in two ways: the operators tend to
get scattered across different columns on the screen, and each
operator is moved away from its operand and onto the previous
line.
Change-Id: Ieedde356f613ce57caf3fe190fb44e0404337f97
Reviewed-on: http://gerrit.cloudera.org:8080/11196
Reviewed-by: Jim Apple <jbapple-impala@apache.org>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
I got feedback that the flake8 rules are a little too strict, so based
on the dev@impala.apache.org discussion am disabling some of them.
I left E302 "expected 2 blank lines, found 1" enabled since I think it
would force our formatting to be more consistent, but I'm open to
changing that.
I used the following command to get a sense of the number of existing
violations:
EXCLUDES=ext-py,shell/build,gerrit_critic_venv,infra/python/env
EXCLUDES+=,shell/pkg_resources.py,shell/thrift_sasl.py,gen-py
EXCLUDES+=,TPC-DS-master,toolchain
./bin/impala-flake8 --exclude=${EXCLUDES}
Change-Id: Iaaa8377025e732231ac0f1f1f2db67298a171997
Reviewed-on: http://gerrit.cloudera.org:8080/11102
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Tim Armstrong <tarmstrong@cloudera.com>
Add flake8 and dependencies to impala-python. The versions are
compatible with Python 2.6.6. Add the impala-flake8 entry point, similar
to impala-python.
Add setup.cfg which defines flake8 special rules and exemptions. They
are added to support 2-space indents and a max line length of 90.
Contributors writing Python can use impala-flake8 to look for formatting
mistakes. The two most common uses would be:
impala-flake8 myfile.py
or
git diff HEAD^ myfile.py | impala-flake8 --diff
In the second usage, flake8 will only examine lines changed. This allows
a contributor to fix their own code and not be penalized by flake8
violations that may already be present (though they are encouraged to
fix them if they can!)
Change-Id: Ib4ce9eca6f8b55eaec1c96e7db1ff630ac016be0
Reviewed-on: http://gerrit.cloudera.org:8080/10182
Reviewed-by: Michael Brown <mikeb@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>