Start splitting the DBInstaller class into distro-specific versions. Only Oneiric is implemented for now.

This commit is contained in:
Doug Hellmann 2012-03-14 16:56:36 -04:00
parent 81cbd39b67
commit 993173e2cb
3 changed files with 30 additions and 12 deletions

View File

@ -120,18 +120,11 @@ class DBInstaller(comp.PkgInstallComponent):
fc = utils.joinlinesep(*new_lines)
with sh.Rooted(True):
sh.write_file('/etc/my.cnf', fc)
elif self.distro == settings.UBUNTU11 and dbtype == MYSQL:
LOG.info("Fixing up %s mysql configs." % (settings.UBUNTU11))
fc = sh.load_file('/etc/mysql/my.cnf')
lines = fc.splitlines()
new_lines = list()
for line in lines:
if line.startswith('bind-address'):
line = 'bind-address = %s' % ('0.0.0.0')
new_lines.append(line)
fc = utils.joinlinesep(*new_lines)
with sh.Rooted(True):
sh.write_file('/etc/mysql/my.cnf', fc)
else:
raise NotImplementedError(
'Do not know how to configure db confs for %s' %
self.distro.name
)
def _get_pkgs(self):
return list(REQ_PKGS)

View File

View File

@ -0,0 +1,25 @@
"""Platform-specific logic for Ubunutu Oneiric components.
"""
from devstack.components import db
from devstack import log as logging
from devstack import shell as sh
from devstack import utils
LOG = logging.getLogger(__name__)
class OneiricDBInstaller(db.DBInstaller):
def _configure_db_confs(self):
LOG.info("Fixing up %s mysql configs.", self.distro.name)
fc = sh.load_file('/etc/mysql/my.cnf')
lines = fc.splitlines()
new_lines = list()
for line in lines:
if line.startswith('bind-address'):
line = 'bind-address = %s' % ('0.0.0.0')
new_lines.append(line)
fc = utils.joinlinesep(*new_lines)
with sh.Rooted(True):
sh.write_file('/etc/mysql/my.cnf', fc)