Skip to content

Commit

Permalink
monodb: mysql-health/pgsql-health: add fallback to IDENTIFIER_REDMINE
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed Sep 17, 2024
1 parent 70d3e11 commit 7f5e1d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/monodb/mysql-health.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ function check_cluster_status() {

IDENTIFIER_REDMINE=$(echo "$IDENTIFIER" | cut -d'-' -f1-2)

if [[ "$IDENTIFIER" == "$IDENTIFIER_REDMINE" ]]; then
# Remove all numbers from the end of the string
# Should result in test-test2-test
IDENTIFIER_REDMINE=$(echo "$IDENTIFIER" | sed 's/[0-9]*$//')
fi

if [[ ! -f /tmp/mono/mysql-cluster-size-redmine.log ]]; then
if monokit redmine issue exists --subject "Cluster size is $no_cluster at $IDENTIFIER_REDMINE" --date "$(date +"%Y-%m-%d")" >"$TMP_PATH_SCRIPT"/pgsql-cluster-size-redmine.log; then
ISSUE_ID=$(cat "$TMP_PATH_SCRIPT"/mysql-cluster-size-redmine.log)
Expand Down
7 changes: 7 additions & 0 deletions scripts/monodb/pgsql-health.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ function cluster_status() {
# IDENTIFIER_REDMINE=test-test2
IDENTIFIER_REDMINE=$(echo "$IDENTIFIER" | cut -d'-' -f1-2)

# Fallback
if [[ "$IDENTIFIER" == "$IDENTIFIER_REDMINE" ]]; then
# Remove all numbers from the end of the string
# Should result in test-test2-test
IDENTIFIER_REDMINE=$(echo "$IDENTIFIER" | sed 's/[0-9]*$//')
fi

if [[ ! -f /tmp/mono/pgsql-cluster-size-redmine.log ]]; then
if monokit redmine issue exists --subject "PgSQL Cluster size is $((i - j)) at $IDENTIFIER_REDMINE" --date "$(date +"%Y-%m-%d")" > "$TMP_PATH_SCRIPT"/pgsql-cluster-size-redmine.log; then
ISSUE_ID=$(cat "$TMP_PATH_SCRIPT"/pgsql-cluster-size-redmine.log)
Expand Down

0 comments on commit 7f5e1d7

Please sign in to comment.