anmolnar commented on code in PR #2467:
URL: https://github.com/apache/phoenix/pull/2467#discussion_r3226496787


##########
bin/phoenix_utils.py:
##########
@@ -126,6 +127,21 @@ def setPath():
             # Try to provide something valid
             hbase_conf_dir = '.'
 
+    global zk_tls_args
+    root = ET.parse(os.path.join(hbase_conf_dir, "hbase-site.xml")).getroot()
+    zk_hbase_prefix = "hbase.zookeeper.property."
+    zkcfg = {
+        prop.find("name").text[len(zk_hbase_prefix):]: prop.find("value").text
+        for prop in root.findall("property")
+        if prop.find("name").text.startswith(zk_hbase_prefix)
+    }
+    if zkcfg.get('client.secure').lower() == 'true':
+        zk_tls_args = '-Dzookeeper.client.secure=true ' + \
+            '-Dzookeeper.clientCnxnSocket=' + zkcfg['clientCnxnSocket'] + ' ' 
+ \
+            '-Dzookeeper.ssl.trustStore.location=' + 
zkcfg['ssl.trustStore.location'] + ' ' + \
+            '-Dzookeeper.ssl.trustStore.type=' + zkcfg['ssl.trustStore.type'] 
+ ' ' + \
+            '-Dzookeeper.ssl.trustStore.password=' + 
zkcfg['ssl.trustStore.password'] + ' '
+

Review Comment:
   Default "" doesn't make any difference in Python. The field will be 
undefined. We have two options: use the `getattr` call as below, or define 
`zk_tls_args` at top level of this file.
   
   Certainly I can add exception handler, but there's no exception handling 
anywhere else in this file. Does it make sense?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to