Skip to content

Commit

Permalink
Merge pull request #1721 from M0ses/restart_apache_after_cert_change
Browse files Browse the repository at this point in the history
[dist] setup_appliance.sh restarts apache now if change of certs was …
  • Loading branch information
hennevogel committed Apr 22, 2016
2 parents 5705e3f + b0d9818 commit 6e11708
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions dist/setup-appliance.sh
Expand Up @@ -325,12 +325,17 @@ function import_ca_cert {
###############################################################################
function relink_server_cert {

if [[ $DETECTED_CERT_CHANGE == 1 || ! -e $backenddir/certs/server.crt ]];then
# change links for certs according to hostnames
cd $backenddir/certs
rm -f server.crt
ln -sf server.${FQHOSTNAME}.crt server.crt
cd - >/dev/null
if [[ $DETECTED_CERT_CHANGE == 1 ]];then
CERT_LINK_FILE=$backenddir/certs/server.crt
# check if CERT_LINK_FILE not exists or is symbolic link because we don't
# want to remove real files
if [ ! -e $CERT_LINK_FILE || -L $CERT_LINK_FILE ];then
# change links for certs according to hostnames
cd $backenddir/certs
rm -f server.crt
ln -sf server.${FQHOSTNAME}.crt server.crt
cd - >/dev/null
fi
fi
}

Expand Down Expand Up @@ -555,10 +560,10 @@ if [[ ! $BOOTSTRAP_TEST_MODE == 1 && $0 != "-bash" ]];then

DNS_NAMES="$rv"

check_server_cert

DETECTED_CERT_CHANGE=0

check_server_cert

import_ca_cert

relink_server_cert
Expand All @@ -573,6 +578,11 @@ if [[ ! $BOOTSTRAP_TEST_MODE == 1 && $0 != "-bash" ]];then

check_service memcached

# make sure that apache gets restarted after cert change
if [[ $DETECTED_CERT_CHANGE ]];then
systemctl restart apache2.service
fi

check_service obsapidelayed

create_issue_file
Expand Down

0 comments on commit 6e11708

Please sign in to comment.