diff options
Diffstat (limited to 'lib/modules')
-rw-r--r-- | lib/modules/mysql_user2 | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/modules/mysql_user2 b/lib/modules/mysql_user2 index c3cc38f..f2d9d40 100644 --- a/lib/modules/mysql_user2 +++ b/lib/modules/mysql_user2 @@ -338,41 +338,41 @@ def config_get(config, section, option): See: http://dev.mysql.com/doc/refman/5.0/en/option-files.html """ return strip_quotes(config.get(section, option)) def _safe_cnf_load(config, path): data = {'user':'', 'password':''} # read in user/pass f = open(path, 'r') for line in f.readlines(): line = line.strip() if line.startswith('user='): data['user'] = line.split('=', 1)[1].strip() if line.startswith('password=') or line.startswith('pass='): data['password'] = line.split('=', 1)[1].strip() f.close() - # write out a new cnf file with only user/pass + # write out a new cnf file with only user/pass fh, newpath = tempfile.mkstemp(prefix=path + '.') f = open(newpath, 'wb') f.write('[client]\n') f.write('user=%s\n' % data['user']) f.write('password=%s\n' % data['password']) f.close() config.readfp(open(newpath)) os.remove(newpath) return config 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)) except (IOError): return False |