From 086149eebae491634b86550b32656648a5c7cc79 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 24 Aug 2024 11:57:33 +0900 Subject: [PATCH] mysql: Use oslo_utils implementation to parse boolean ... instead of implementing own logic. Change-Id: Ibec53f15c6043cc2916f39aeae9fd63052d2f54d --- tooz/drivers/mysql.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tooz/drivers/mysql.py b/tooz/drivers/mysql.py index 2915c749..ddb6fcb0 100644 --- a/tooz/drivers/mysql.py +++ b/tooz/drivers/mysql.py @@ -16,6 +16,7 @@ import logging from oslo_utils import encodeutils +from oslo_utils import strutils import pymysql import tooz @@ -215,12 +216,10 @@ class MySQLDriver(coordination.CoordinationDriver): if value: ssl_args[o] = value check_hostname = options.get("ssl_check_hostname") + check_hostname = strutils.bool_from_string(check_hostname, + default=None) if check_hostname is not None: - check_hostname = check_hostname.lower() - if check_hostname in ("true", "1", "yes"): - ssl_args["check_hostname"] = True - elif check_hostname in ("false", "0", "no"): - ssl_args["check_hostname"] = False + ssl_args['check_hostname'] = check_hostname try: if unix_socket: