diff --git a/mongo/hooks/mongo_database-relation-joined b/mongo/hooks/mongo_database-relation-joined index b93b7ed3..ce5cba53 100755 --- a/mongo/hooks/mongo_database-relation-joined +++ b/mongo/hooks/mongo_database-relation-joined @@ -44,13 +44,14 @@ out=$(ddb < <(echo "use $DBNAME"; echo "$cmd")) if [[ "$out" == *"\"codeName\" : \"AlreadyInitialized\""* ]]; then - exit 0 + info "ReplicaSet already initialized." +elif [[ "$out" == *"\"ok\" : 1"* ]]; then + info "ReplicaSet initialized. " +else + err "ReplicaSet initialisation failed:" + echo "$out" >&2 + exit 13 fi -if [[ "$out" == *"\"ok\" : 1"* ]]; then - exit 0 -fi -err Replicate Set initialisation failed -echo "$out" >&2