mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
Check file exists instead of relying on the exception. Leave the exception catch in, in case the file is deleted or some other issue crops up
This commit is contained in:
parent
888ac86d70
commit
7395becf3a
2 changed files with 4 additions and 0 deletions
|
@ -145,6 +145,8 @@ def privileges_grant(cursor, user,host,db_table,priv):
|
|||
def load_mycnf():
|
||||
config = ConfigParser.RawConfigParser()
|
||||
mycnf = os.path.expanduser('~/.my.cnf')
|
||||
if not os.path.exists(mycnf):
|
||||
return False
|
||||
try:
|
||||
config.readfp(open(mycnf))
|
||||
creds = dict(user=config.get('client', 'user'),passwd=config.get('client', 'pass'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue