From 90d434d66d5382c009e80d95146c4b049fc7bedd Mon Sep 17 00:00:00 2001 From: Sven Schliesing Date: Wed, 22 Apr 2015 20:32:39 +0200 Subject: [PATCH] use default value for parameter config_file in connect() --- lib/ansible/modules/database/mysql/mysql_user.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/database/mysql/mysql_user.py b/lib/ansible/modules/database/mysql/mysql_user.py index e3a4a76a55..c92a63c1ae 100644 --- a/lib/ansible/modules/database/mysql/mysql_user.py +++ b/lib/ansible/modules/database/mysql/mysql_user.py @@ -183,11 +183,7 @@ class InvalidPrivsError(Exception): # MySQL module specific support methods. # -def connect(module, login_user, login_password, config_file): - default_file = '~/.my.cnf' - if config_file is not None: - default_file = config_file - +def connect(module, login_user, login_password, config_file='~/.my.cnf'): config = { 'host': module.params['login_host'], 'db': 'mysql' @@ -198,8 +194,8 @@ def connect(module, login_user, login_password, config_file): else: config['port'] = module.params['login_port'] - if os.path.exists(default_file): - config['read_default_file'] = default_file + if os.path.exists(config_file): + config['read_default_file'] = config_file else: config['user'] = login_user config['passwd'] = login_password