~clint-fewbar/charms/precise/mysql/trunk

« back to all changes in this revision

Viewing changes to hooks/master-relation-departed

  • Committer: Clint Byrum
  • Date: 2012-11-01 21:35:55 UTC
  • Revision ID: clint@ubuntu.com-20121101213555-uht8qdxw54y92sh8
Remove augtool for simpler Apache handling, and also use --add-drop-database to make slave refreshing more robust

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
ROOTARGS="-uroot -p`cat /var/lib/juju/mysql.passwd`"
4
 
remote_ip=`relation-get ip`
5
 
mysql $ROOTARGS -e "REVOKE PRIVILEGES ON *.* FROM `$JUJU_REMOTE_UNIT`@`$remote_ip`"
6
 
# find allow lines
7
 
for aline in `augtool ls /files/etc/apache2/sites-available/default/VirtualHost/Directory[2]|grep " = allow"|cut -d' ' -f1` ; do
8
 
  ip=`augtool get /files/etc/apache2/sites-available/default/VirtualHost/Directory[2]/$aline/arg[2]`
9
 
  if [ "$ip" = "$remote_ip/32" ] ; then
10
 
    echo -e "rm /files/etc/apache2/sites-available/default/VirtualHost/Directory[2]/$aline\nsave" | augtool -b
11
 
    echo removed $aline from /files/etc/apache2/sites-available/default/VirtualHost/Directory[2]
12
 
    service apache2 reload
13
 
    break
14
 
  fi
15
 
done