Make datadir dynamic depending on ubuntu version

This commit is contained in:
James Page 2015-09-18 11:52:48 +01:00
parent 5b3618e67c
commit 2c31d7b136
2 changed files with 8 additions and 2 deletions

View File

@ -114,6 +114,11 @@ def render_config(clustered=False, hosts=[]):
if not os.path.exists(os.path.dirname(MY_CNF)):
os.makedirs(os.path.dirname(MY_CNF))
if lsb_release()['DISTRIB_CODENAME'] < 'vivid':
data_dir = '/var/lib/mysql'
else:
data_dir = '/var/lib/percona'
context = {
'cluster_name': 'juju_cluster',
'private_address': get_host_ip(),
@ -123,7 +128,8 @@ def render_config(clustered=False, hosts=[]):
'sst_password': config('sst-password'),
'innodb_file_per_table': config('innodb-file-per-table'),
'table_open_cache': config('table-open-cache'),
'lp1366997_workaround': config('lp1366997-workaround')
'lp1366997_workaround': config('lp1366997-workaround'),
'data_dir': data_dir,
}
if config('prefer-ipv6'):

View File

@ -9,7 +9,7 @@ bind-address = {{ bind_address }}
wsrep_provider_options = {{ wsrep_provider_options }}
{% endif %}
datadir=/var/lib/mysql
datadir={{ data_dir }}
user=mysql
pid_file = /var/run/mysqld/mysqld.pid