Skip to content

Commit c3409c8

Browse files
authored
Merge pull request #79 from corva-ai/fix/mongodb-catch-and-exit-when-errors-initializing-the-rs
fix: catch and exit with error when rs initialization fails
2 parents 9306129 + 84016f7 commit c3409c8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

start-mongodb.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,21 @@ docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT --port $MONGODB_PORT $
205205
})
206206
"
207207

208+
if [ $? -ne 0 ]; then
209+
echo "Error initiating replica set [$MONGODB_REPLICA_SET]"
210+
exit 2
211+
fi
212+
208213
echo "Success! Initiated replica set [$MONGODB_REPLICA_SET]"
209214
echo "::endgroup::"
210215

211216

212217
echo "::group::Checking replica set status [$MONGODB_REPLICA_SET]"
213218
docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT --port $MONGODB_PORT $MONGODB_ARGS --eval "rs.status()"
219+
220+
if [ $? -ne 0 ]; then
221+
echo "Error checking replica set status [$MONGODB_REPLICA_SET]"
222+
exit 2
223+
fi
224+
214225
echo "::endgroup::"

0 commit comments

Comments
 (0)