mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
use default value for parameter config_file in connect()
This commit is contained in:
parent
dcb8fa0cb9
commit
90d434d66d
1 changed files with 3 additions and 7 deletions
|
@ -183,11 +183,7 @@ class InvalidPrivsError(Exception):
|
||||||
# MySQL module specific support methods.
|
# MySQL module specific support methods.
|
||||||
#
|
#
|
||||||
|
|
||||||
def connect(module, login_user, login_password, config_file):
|
def connect(module, login_user, login_password, config_file='~/.my.cnf'):
|
||||||
default_file = '~/.my.cnf'
|
|
||||||
if config_file is not None:
|
|
||||||
default_file = config_file
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
'host': module.params['login_host'],
|
'host': module.params['login_host'],
|
||||||
'db': 'mysql'
|
'db': 'mysql'
|
||||||
|
@ -198,8 +194,8 @@ def connect(module, login_user, login_password, config_file):
|
||||||
else:
|
else:
|
||||||
config['port'] = module.params['login_port']
|
config['port'] = module.params['login_port']
|
||||||
|
|
||||||
if os.path.exists(default_file):
|
if os.path.exists(config_file):
|
||||||
config['read_default_file'] = default_file
|
config['read_default_file'] = config_file
|
||||||
else:
|
else:
|
||||||
config['user'] = login_user
|
config['user'] = login_user
|
||||||
config['passwd'] = login_password
|
config['passwd'] = login_password
|
||||||
|
|
Loading…
Add table
Reference in a new issue