Skip to content

Commit

Permalink
Merge pull request #1563 from mapellidario/20241108_wmagent_initcouch
Browse files Browse the repository at this point in the history
wmagent - stop init if local couchdb is not empty - take2
  • Loading branch information
mapellidario authored Nov 13, 2024
2 parents c835caa + 66e297d commit 5535eee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 1 addition & 4 deletions docker/pypi/wmagent/bin/manage-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,7 @@ _couch_db_isclean(){
echo "$FUNCNAME: Checking if local CouchDB is empty (curl to wmagent_summary db name)"
agent_summary=$(curl -s -u "$COUCH_USER:$COUCH_PASS" http://$COUCH_HOST:$COUCH_PORT/wmagent_summary)

if ! type jq > /dev/null ; then
echo "$FUNCNAME: jq is not installed, we cannot check if CouchDB is empty. Skipping this step."
return $(true)
fi
type jq > /dev/null || { echo "$FUNCNAME: jq is not installed, we cannot check if CouchDB is empty. Skipping this step."; return $(true); }
agent_summary_notclean=$(jq "select(.doc_count > 1 or .doc_del_count > 0)" <<< $agent_summary)

if [ -n "${agent_summary_notclean}" ]; then
Expand Down
1 change: 1 addition & 0 deletions docker/pypi/wmagent/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ check_databases() {
esac

# Checking CouchDB:
couchdbCred=false
[[ -n $COUCH_HOST ]] && [[ -n $COUCH_PORT ]] && [[ -n $COUCH_USER ]] && [[ -n $COUCH_PASS ]] &&
couchdbCred=true
$couchdbCred || { echo "$FUNCNAME: ERROR: No local CouchDB credentials provided at $WMA_SECRETS_FILE" ; return $(false); }
Expand Down

0 comments on commit 5535eee

Please sign in to comment.