github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/xenial/wordpress/hooks/loadbalancer-relation-changed (about) 1 #!/bin/bash 2 # 3 # loadbalancer-relation-changed - hook for when loadbalancer peer relation changes 4 # 5 # Copyright (C) 2012 Marco Ceppi 6 # Author: Marco Ceppi <marco@ceppi.net> 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation, either version 3 of the License, or 11 # (at your option) any later version. 12 # 13 # This program is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program. If not, see <http://www.gnu.org/licenses/>. 20 # 21 22 source inc/common 23 24 secret_key=`relation-get secret-key` 25 26 if [ "$secret_key" = "" ]; then 27 if [ -f ".wp-secret" ]; then 28 relation-set secret-key=`cat .wp-secret` 29 fi 30 else 31 echo $secret_key > .wp-secret 32 fi 33 34 if [ -f "$config_info_path" ]; then 35 secret_key=`cat .wp-secret` 36 sed -i -e "s/define('SECRET_KEY',.*/define('SECRET_KEY', '$secret_key')\;/" $config_info_path 37 fi