From 931f32cac65b420e78210a0feb1afdcd2f26201c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Inderm=C3=BChle?= Date: Fri, 27 Jan 2023 08:54:12 +0100 Subject: [PATCH] Refactor to handle Unknown in the if block Co-authored-by: Andrew Klychkov --- plugins/module_utils/mysql.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/mysql.py b/plugins/module_utils/mysql.py index 8da39cf..3567fa1 100644 --- a/plugins/module_utils/mysql.py +++ b/plugins/module_utils/mysql.py @@ -70,11 +70,12 @@ def get_driver_version(mysql_driver): # - VERSION that returns the tupple (0, 7, 11, None) v = mysql_driver.VERSION[:3] return '.'.join(map(str, v)) - - if driver_name == 'MySQLdb': + elif driver_name == 'MySQLdb': # version_info returns the tuple (2, 1, 1, 'final', 0) v = mysql_driver.version_info[:3] return '.'.join(map(str, v)) + else: + return 'Unknown' def parse_from_mysql_config_file(cnf):