1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/bin/bash
# Add a MySQL connection. This adds a pointer to saiku so it can facilitate easier application of data sources for the user.
set -ex # -x for verbose logging to juju debug-log
juju-log "Joining database at $JUJU_REMOTE_UNIT"
hostname=`unit-get public-address`
juju-log "from host: $hostname"
host=`relation-get private-address`
juju-log "updating file"
u=`relation-get user`
p=`relation-get password`
d=`relation-get database`
printf "name=mysql\njdbcurl=jdbc:mysql://$host:3396/$d\nusername=$u\npassword=$p\ndriver=com.mysql.jdbc.Driver" > /var/lib/tomcat7/webapps/saiku/WEB-INF/classes/juju-datasources/mysql
juju-log "MySQL connection acquired"
|