zookeeper: fix argparse related to ssl

string 'False' cannot be converted to bool False directly
if use_ssl=False or verify_certs=True is set in the url, something
goes wrong

Change-Id: I579da1d195d34d0533f98acb283b300a90d4f595
This commit is contained in:
XuQi 2024-08-28 09:52:36 +00:00
parent 734acc401c
commit b12f59e2ec

View File

@ -477,6 +477,8 @@ class KazooDriver(coordination.CoordinationDriverCachedRunWatchers):
if not hosts:
hosts = ['localhost:2181']
randomize_hosts = options.get('randomize_hosts', True)
use_ssl = options.get('use_ssl', False)
verify_certs = options.get('verify_certs', True)
client_kwargs = {
'auth_data': auth_data,
'ca': options.get('ca', None),
@ -489,8 +491,8 @@ class KazooDriver(coordination.CoordinationDriverCachedRunWatchers):
'keyfile_password': options.get('keyfile_password', None),
'randomize_hosts': strutils.bool_from_string(randomize_hosts),
'timeout': float(options.get('timeout', self.timeout)),
'use_ssl': bool(options.get('use_ssl', False)),
'verify_certs': bool(options.get('verify_certs', True)),
'use_ssl': strutils.bool_from_string(use_ssl),
'verify_certs': strutils.bool_from_string(verify_certs),
}
handler_kind = options.get('handler')
if handler_kind: