Fix mongodb.conf corruption during stack.sh

MongoDB can't start, if mongodb.conf has duplicate parameters.

When using Zaqar as plugin in DevStack on debian-like system,
each run of stack.sh adds a new line to etc/mongodb.conf:
"smallfiles=true"
So eventually mongodb.conf will contain duplicate parameters.

It means that stack.sh will be able to execute successfully only once,
on subsequent executions it will fail,
because of Zaqar which will fail to start,
because of MongoDB which will fail to start,
because of corrupted mongodb.conf
which will be corrupted by zaqar/devstack/plugin.sh

This commit will make sure that "smallfiles=true" line will be added to
mongodb.conf only if mongodb.conf doesn't contain this line already.

Change-Id: Ieba5abb970ff7565f3a837778e402ea8d5c5c463
Closes-Bug: 1507391
This commit is contained in:
Eva Balycheva 2015-10-19 06:52:41 +03:00
parent 98713540a8
commit 9ac47de9d6
1 changed files with 3 additions and 1 deletions

View File

@ -202,7 +202,9 @@ function configure_mongodb {
pip_install pymongo
if is_ubuntu; then
install_package mongodb-server
echo "smallfiles = true" | sudo tee --append /etc/mongodb.conf > /dev/null
if ! grep -qF "smallfiles = true" /etc/mongodb.conf; then
echo "smallfiles = true" | sudo tee --append /etc/mongodb.conf > /dev/null
fi
restart_service mongodb
elif is_fedora; then
install_package mongodb