This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new a14f1c5  [python functions] fix tls_validate_hostname is not supported 
in python functions runtime (#11087)
a14f1c5 is described below

commit a14f1c5940fe656348b6d7d326596358f43dcbc9
Author: Rui Fu <freez...@users.noreply.github.com>
AuthorDate: Tue Jul 20 11:13:39 2021 +0800

    [python functions] fix tls_validate_hostname is not supported in python 
functions runtime (#11087)
    
    ### Motivation
    
    Pulsar's python client support define TLS parameters, like 
`tls_validate_hostname`, but in python functions runtime, it is not been set 
properly.
    
    ### Modifications
    
    - get `hostname_verification_enabled` from python instance arguments
    - pass `hostname_verification_enabled` to pulsar client
    
    ### Verifying this change
    
    - [x] Make sure that the change passes the CI checks.
---
 pulsar-functions/instance/src/main/python/python_instance_main.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pulsar-functions/instance/src/main/python/python_instance_main.py 
b/pulsar-functions/instance/src/main/python/python_instance_main.py
index 322d728..6270134 100644
--- a/pulsar-functions/instance/src/main/python/python_instance_main.py
+++ b/pulsar-functions/instance/src/main/python/python_instance_main.py
@@ -150,6 +150,7 @@ def main():
   use_tls = False
   tls_allow_insecure_connection = False
   tls_trust_cert_path = None
+  hostname_verification_enabled = False
   if args.client_auth_plugin and args.client_auth_params:
       authentication = pulsar.Authentication(args.client_auth_plugin, 
args.client_auth_params)
   if args.use_tls == "true":
@@ -158,10 +159,13 @@ def main():
     tls_allow_insecure_connection = True
   if args.tls_trust_cert_path:
      tls_trust_cert_path =  args.tls_trust_cert_path
+  if args.hostname_verification_enabled == "true":
+    hostname_verification_enabled = True
   pulsar_client = pulsar.Client(args.pulsar_serviceurl, 
authentication=authentication, operation_timeout_seconds=30,
                                 io_threads=1, message_listener_threads=1, 
concurrent_lookup_requests=50000,
                                 log_conf_file_path=None, use_tls=use_tls, 
tls_trust_certs_file_path=tls_trust_cert_path,
-                                
tls_allow_insecure_connection=tls_allow_insecure_connection)
+                                
tls_allow_insecure_connection=tls_allow_insecure_connection,
+                                
tls_validate_hostname=hostname_verification_enabled)
 
   state_storage_serviceurl = None
   if args.state_storage_serviceurl is not None:

Reply via email to