diff --git a/library/mysql_db b/library/mysql_db index 3a620f8494..85b25cb99d 100755 --- a/library/mysql_db +++ b/library/mysql_db @@ -47,6 +47,8 @@ def db_create(cursor, db): 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')) diff --git a/library/mysql_user b/library/mysql_user index 6734961a74..1cba17e9a9 100755 --- a/library/mysql_user +++ b/library/mysql_user @@ -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'))