mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adding back support for pass=
This commit is contained in:
parent
6a12d64059
commit
234d31bf72
2 changed files with 28 additions and 4 deletions
|
@ -131,8 +131,20 @@ def load_mycnf():
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
config.readfp(open(mycnf))
|
config.readfp(open(mycnf))
|
||||||
creds = dict(user=config.get('client', 'user'),passwd=config.get('client', 'password'))
|
except (IOError):
|
||||||
except (ConfigParser.NoOptionError, IOError):
|
return False
|
||||||
|
# We support two forms of passwords in .my.cnf, both pass= and password=,
|
||||||
|
# as these are both supported by MySQL.
|
||||||
|
try:
|
||||||
|
passwd = config.get('client', 'password')
|
||||||
|
except (ConfigParser.NoOptionError):
|
||||||
|
try:
|
||||||
|
passwd = config.get('client', 'pass')
|
||||||
|
except (ConfigParser.NoOptionError):
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
creds = dict(user=config.get('client', 'user'),passwd=passwd)
|
||||||
|
except (ConfigParser.NoOptionError):
|
||||||
return False
|
return False
|
||||||
return creds
|
return creds
|
||||||
|
|
||||||
|
|
|
@ -236,8 +236,20 @@ def load_mycnf():
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
config.readfp(open(mycnf))
|
config.readfp(open(mycnf))
|
||||||
creds = dict(user=config.get('client', 'user'),password=config.get('client', 'password'))
|
except (IOError):
|
||||||
except (ConfigParser.NoOptionError, IOError):
|
return False
|
||||||
|
# We support two forms of passwords in .my.cnf, both pass= and password=,
|
||||||
|
# as these are both supported by MySQL.
|
||||||
|
try:
|
||||||
|
passwd = config.get('client', 'password')
|
||||||
|
except (ConfigParser.NoOptionError):
|
||||||
|
try:
|
||||||
|
passwd = config.get('client', 'pass')
|
||||||
|
except (ConfigParser.NoOptionError):
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
creds = dict(user=config.get('client', 'user'),passwd=passwd)
|
||||||
|
except (ConfigParser.NoOptionError):
|
||||||
return False
|
return False
|
||||||
return creds
|
return creds
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue