Browse Source

Update credential issue of Mysql

feature/refactor-php
Prabuddha Chakraborty 10 years ago
parent
commit
4d58f1b7de
  1. 4
      ee/cli/plugins/stack_migrate.py
  2. 3
      ee/core/mysql.py
  3. 3
      ee/core/variables.py

4
ee/cli/plugins/stack_migrate.py

@ -46,7 +46,11 @@ class EEStackMigrateController(CementBaseController):
keyserver="keyserver.ubuntu.com")
config = configparser.ConfigParser()
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
config.read('/etc/mysql/conf.d/my.cnf')
else:
config.read(os.path.expanduser("~")+'/.my.cnf')
try:
chars = config['client']['password']
except Exception as e:

3
ee/core/mysql.py

@ -30,7 +30,10 @@ class EEMysql():
def connect(self):
"""Makes connection with MySQL server"""
try:
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
connection = pymysql.connect(read_default_file='/etc/mysql/conf.d/my.cnf')
else:
connection = pymysql.connect(read_default_file='~/.my.cnf')
return connection
except ValueError as e:
Log.debug(self, str(e))

3
ee/core/variables.py

@ -70,7 +70,10 @@ class EEVariables():
# MySQL hostname
ee_mysql_host = ""
config = configparser.RawConfigParser()
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
cnfpath = "/etc/mysql/conf.d/my.cnf"
else:
cnfpath = os.path.expanduser("~")+"/.my.cnf"
if [cnfpath] == config.read(cnfpath):
try:
ee_mysql_host = config.get('client', 'host')

Loading…
Cancel
Save