diff options
Diffstat (limited to 'hooks/install')
| -rwxr-xr-x | hooks/install | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/hooks/install b/hooks/install index 2c3d66a..8c208e3 100755 --- a/hooks/install +++ b/hooks/install @@ -5,17 +5,12 @@ set -ux ############################################################################################################ -# Install some utility packages needed for installation -############################################################################################################ -DEBIAN_FRONTEND=noninteractive apt-get -y install facter facter-customfacts-plugin - -############################################################################################################ # Set some variables that we'll need for later ############################################################################################################ DEFAULT_REPLSET_NAME=`config-get replicaset` HOSTNAME=`hostname -f` EPOCH=`date +%s` -fact-add install-time ${EPOCH} +INSTALL_ORDER=$(echo ${JUJU_UNIT_NAME} | awk -F/ '{ print $2 }') WEB_ADMIN_UI=`config-get web_admin_ui` REPLICASET_MASTER=`config-get replicaset_master` @@ -61,6 +56,13 @@ service mongodb start # Are we connecting to an existing replica set? ############################################################################################################ if [ "${REPLICASET_MASTER}" != "auto" ]; then + grep "${DEFAULT_REPLSET_NAME}" /etc/init/mongodb.conf + if [ $? -ne 0 ];then + sed -i -e "s/ -- / -- --replSet ${DEFAULT_REPLSET_NAME} /" /etc/init/mongodb.conf + service mongodb stop + rm -f /var/lib/mongodb/mongod.lock + service mongodb start + fi mongo --host ${REPLICASET_MASTER} --eval "rs.add(\""${HOSTNAME}"\")" fi |
