Skip to content

Commit

Permalink
Closes-bug: #1494017, Modify postinstall to use the new configuration…
Browse files Browse the repository at this point in the history
… changes to support server manager lite

Change-Id: Idfef75d06ac533507736cb9b86fab141ced57d50
  • Loading branch information
miriyalar committed Sep 9, 2015
1 parent cd02a54 commit b87a362
Showing 1 changed file with 52 additions and 9 deletions.
61 changes: 52 additions & 9 deletions common/debian/contrail-web-server-manager/debian/postinst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -e

Expand All @@ -14,9 +14,12 @@ mkdir -p /var/log/contrail/

# Newly added from setup.sh
# Modify webui config file
WEBUI_CONF_FILE=/etc/contrail/config.global.js
WEBUI_CONF_FILE=/etc/contrail/config.global.sm.js
SM_CONF_FILE=/usr/src/contrail/contrail-web-server-manager/webroot/common/api/sm.config.js
WEBUI_PATH=/usr/src/contrail/contrail-web-server-manager
WEBUI_STORAGE_PATH=/usr/src/contrail/contrail-web-storage
WEBUI_WEBCONTROLLER_PATH=/usr/src/contrail/contrail-web-controller
WEBUI_STORAGE_PATH=/usr/src/contrail/contrail-web-storage

set +e
grep "config.featurePkg" $WEBUI_CONF_FILE
Expand All @@ -40,6 +43,41 @@ if [ $? == 0 ]; then
else
echo "config.featurePkg.serverManager.enable = true;" >> $WEBUI_CONF_FILE
fi

grep "config.featurePkg.webController = {};" $WEBUI_CONF_FILE
if [ $? != 0 ]; then
echo "config.featurePkg.webController = {};" >> $WEBUI_CONF_FILE
fi
grep "config.featurePkg.webController.path" $WEBUI_CONF_FILE
if [ $? == 0 ]; then
sed -i "s|config.featurePkg.webController.path = .*|config.featurePkg.webController.path = '$WEBUI_WEBCONTROLLER_PATH';|g" $WEBUI_CONF_FILE
else
echo "config.featurePkg.webController.path = '$WEBUI_WEBCONTROLLER_PATH';" >> $WEBUI_CONF_FILE
fi
grep "config.featurePkg.webController.enable" $WEBUI_CONF_FILE
if [ $? == 0 ]; then
sed -i "s/config.featurePkg.webController.enable = .*/config.featurePkg.webController.enable = false;/g" $WEBUI_CONF_FILE
else
echo "config.featurePkg.webController.enable = false;" >> $WEBUI_CONF_FILE
fi

grep "config.featurePkg.webStorage = {};" $WEBUI_CONF_FILE
if [ $? != 0 ]; then
echo "config.featurePkg.webStorage = {};" >> $WEBUI_CONF_FILE
fi
grep "config.featurePkg.webStorage.path" $WEBUI_CONF_FILE
if [ $? == 0 ]; then
sed -i "s|config.featurePkg.webStorage.path = .*|config.featurePkg.webStorage.path = '$WEBUI_STORAGE_PATH';|g" $WEBUI_CONF_FILE
else
echo "config.featurePkg.webStorage.path = '$WEBUI_STORAGE_PATH';" >> $WEBUI_CONF_FILE
fi
grep "config.featurePkg.webStorage.enable" $WEBUI_CONF_FILE
if [ $? == 0 ]; then
sed -i "s/config.featurePkg.webStorage.enable = .*/config.featurePkg.webStorage.enable = false;/g" $WEBUI_CONF_FILE
else
echo "config.featurePkg.webStorage.enable = false;" >> $WEBUI_CONF_FILE
fi

grep "config.orchestration" $WEBUI_CONF_FILE
if [ $? == 0 ]; then
sed -i "s/config.orchestration = .*/config.orchestration = {};/g" $WEBUI_CONF_FILE
Expand Down Expand Up @@ -76,21 +114,26 @@ if [ $? == 0 ]; then
else
echo "config.multi_tenancy.enabled = false;" >> $WEBUI_CONF_FILE
fi
grep "module.exports" $WEBUI_CONF_FILE
if [ $? == 0 ]; then
sed -i "s|module.exports =.*||g" $WEBUI_CONF_FILE
fi
echo "module.exports = config;" >> $WEBUI_CONF_FILE

sed -i "s|module.exports =.*|module.exports = config;|g" $WEBUI_CONF_FILE
sed -i "s/config.featurePkg.webController.enable = .*/config.featurePkg.webController.enable = false;/g" $WEBUI_CONF_FILE
sed -i "s/config.featurePkg.webStorage.enable = .*/config.featurePkg.webStorage.enable = false;/g" $WEBUI_CONF_FILE

sed -i "s/config.http_port = .*/config.http_port = '8145';/g" $WEBUI_CONF_FILE
sed -i "s/config.https_port = .*/config.https_port = '5901';/g" $WEBUI_CONF_FILE
sed -i "s/config.jobServer.server_port = .*/config.jobServer.server_port = '3004';/g" $WEBUI_CONF_FILE
sed -i "s/config.kue.ui_port = .*/config.kue.ui_port = '3006'/g" $WEBUI_CONF_FILE


sed -i "s/smConfig.sm.server_ip = .*/smConfig.sm.server_ip = '$HOSTIP';/g" $SM_CONF_FILE
sed -i "s/smConfig.sm.server_port = .*/smConfig.sm.server_port = 9001;/g" $SM_CONF_FILE
sed -i "s/smConfig.sm.introspect_ip = .*/smConfig.sm.introspect_ip = '$HOSTIP';/g" $SM_CONF_FILE
sed -i "s/smConfig.sm.introspect_port = .*/smConfig.sm.introspect_port = 8106;/g" $SM_CONF_FILE
set -e

# start redis and supervisord
# start redis & supervisord
service redis-server restart
service supervisor restart

# start webui
service supervisor-webui restart
service supervisor-webui-sm restart

0 comments on commit b87a362

Please sign in to comment.