~jorge/charms/precise/mysql/fix-metadata

« back to all changes in this revision

Viewing changes to hooks/master-relation-changed

  • Committer: amulet at dummy-user
  • Date: 2014-08-13 23:19:17 UTC
  • mfrom: (125.1.1 mysql)
  • Revision ID: amulet@dummy-user.tld-20140813231917-ds31xvz21l21mab4
[dweaver] Fix for bug 1314763. Changed the master-relation-changed hook to handle either apache 2.2 or apache 2.4 site configurations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
snapdir=/var/www/snaps
11
11
mkdir -p $snapdir
12
12
apt-get -y install apache2
 
13
APACHE_VERSION=`dpkg-query -W -f='${Version}\n' apache2 | cut -c1-3`
13
14
# disable wide-open access (restrict to each db IP)
14
15
rhosts=""
15
16
remote_ip=""
31
32
rhosts=${rhosts##,}
32
33
 
33
34
# if there are no hosts, we simply disable all access
34
 
target=/etc/apache2/sites-available/mysql-dumps
 
35
if [ "$APACHE_VERSION" = "2.2" ] ; then
 
36
        target=/etc/apache2/sites-available/mysql-dumps
 
37
else
 
38
        target=/etc/apache2/sites-available/mysql-dumps.conf
 
39
fi
35
40
cat > $target <<EOF
36
41
DocumentRoot /var/www
37
42
<Directory /var/www>
48
53
</Directory>
49
54
EOF
50
55
a2ensite mysql-dumps
51
 
a2dissite default
 
56
if [ "$APACHE_VERSION" = "2.2" ] ; then
 
57
        a2dissite default
 
58
else
 
59
        a2dissite 000-default
 
60
fi
52
61
service apache2 reload
53
62
 
54
63
pass=`pwgen -s 16`