-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added override flag to manager util #135
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,64 +145,68 @@ function mod_autofix() { | |
} | ||
|
||
function mod_check_etl_status() { | ||
local migration_exited="running" | ||
title "Checking Data Migration Status" | ||
info "Checking Migration Status" | ||
if [ "$CONTAINER_RUNTIME" == "podman" ]; then | ||
local migration_exited=$(podman container inspect --format '{{.State.Status}}' "migrations") | ||
else | ||
local migration_exited=$(docker inspect --format '{{.State.Status}}' "plextrac-couchbase-migrations-1") | ||
fi | ||
while [ "$migration_exited" == "running" ]; do | ||
# Check if the migration container has exited, e.g., migrations have completed or failed | ||
if [ "${IGNORE_ETL_STATUS:-false}" == "false" ]; then | ||
local migration_exited="running" | ||
title "Checking Data Migration Status" | ||
info "Checking Migration Status" | ||
if [ "$CONTAINER_RUNTIME" == "podman" ]; then | ||
local migration_exited=$(podman container inspect --format '{{.State.Status}}' "migrations") | ||
else | ||
local migration_exited=$(docker inspect --format '{{.State.Status}}' "plextrac-couchbase-migrations-1") | ||
fi | ||
for s in / - \\ \|; do printf "\r$s"; sleep .1; done | ||
done | ||
printf "\r" | ||
info "Migrations complete" | ||
while [ "$migration_exited" == "running" ]; do | ||
# Check if the migration container has exited, e.g., migrations have completed or failed | ||
if [ "$CONTAINER_RUNTIME" == "podman" ]; then | ||
local migration_exited=$(podman container inspect --format '{{.State.Status}}' "migrations") | ||
else | ||
local migration_exited=$(docker inspect --format '{{.State.Status}}' "plextrac-couchbase-migrations-1") | ||
fi | ||
for s in / - \\ \|; do printf "\r$s"; sleep .1; done | ||
done | ||
printf "\r" | ||
info "Migrations complete" | ||
|
||
title "Checking Data ETL Status" | ||
debug "Checking ETL health and status..." | ||
ETL_OUTPUT=${ETL_OUTPUT:-true} | ||
if [ "$CONTAINER_RUNTIME" == "podman" ]; then | ||
local api_running=$(podman container inspect --format '{{.State.Status}}' "plextracapi" | wc -l) | ||
else | ||
local api_running=$(compose_client ps -q plextracapi | wc -l) | ||
fi | ||
if [ $api_running -gt 0 ]; then | ||
title "Checking Data ETL Status" | ||
debug "Checking ETL health and status..." | ||
ETL_OUTPUT=${ETL_OUTPUT:-true} | ||
if [ "$CONTAINER_RUNTIME" == "podman" ]; then | ||
RAW_OUTPUT=$(podman exec plextracapi npm run pg:etl:status --no-update-notifier --if-present) | ||
local api_running=$(podman container inspect --format '{{.State.Status}}' "plextracapi" | wc -l) | ||
else | ||
RAW_OUTPUT=$(compose_client exec plextracapi npm run pg:etl:status --no-update-notifier --if-present) | ||
fi | ||
if [ "$RAW_OUTPUT" == "" ]; then | ||
debug "No ETL status output found or it failed to run." | ||
return | ||
local api_running=$(compose_client ps -q plextracapi | wc -l) | ||
fi | ||
# Find the json content by looking for the first line that starts | ||
# with an opening brace and the first line that starts with a closing brace. | ||
JSON_OUTPUT=$(echo "$RAW_OUTPUT" | sed '/^{/,/^}/!d') | ||
|
||
# Find the summary content by finding the first line that starts | ||
# with a closing brace and selecting all remaining lines after that one. | ||
SUMMARY_OUTPUT=$(echo "$RAW_OUTPUT" | sed '1,/^}/d') | ||
ETLS_COMBINED_STATUS=$(echo $JSON_OUTPUT | jq -r .etlsCombinedStatus) | ||
if [ "${ETL_OUTPUT:-true}" == "true" ]; then | ||
msg "$SUMMARY_OUTPUT\n" | ||
debug "$JSON_OUTPUT\n" | ||
fi | ||
|
||
if [[ "$ETLS_COMBINED_STATUS" == "HEALTHY" ]]; then | ||
info "All ETLs are in a healthy status." | ||
if [ $api_running -gt 0 ]; then | ||
if [ "$CONTAINER_RUNTIME" == "podman" ]; then | ||
RAW_OUTPUT=$(podman exec plextracapi npm run pg:etl:status --no-update-notifier --if-present) | ||
else | ||
etl_failure | ||
RAW_OUTPUT=$(compose_client exec plextracapi npm run pg:etl:status --no-update-notifier --if-present) | ||
fi | ||
if [ "$RAW_OUTPUT" == "" ]; then | ||
debug "No ETL status output found or it failed to run." | ||
return | ||
fi | ||
# Find the json content by looking for the first line that starts | ||
# with an opening brace and the first line that starts with a closing brace. | ||
JSON_OUTPUT=$(echo "$RAW_OUTPUT" | sed '/^{/,/^}/!d') | ||
|
||
# Find the summary content by finding the first line that starts | ||
# with a closing brace and selecting all remaining lines after that one. | ||
SUMMARY_OUTPUT=$(echo "$RAW_OUTPUT" | sed '1,/^}/d') | ||
ETLS_COMBINED_STATUS=$(echo $JSON_OUTPUT | jq -r .etlsCombinedStatus) | ||
if [ "${ETL_OUTPUT:-true}" == "true" ]; then | ||
msg "$SUMMARY_OUTPUT\n" | ||
debug "$JSON_OUTPUT\n" | ||
fi | ||
|
||
if [[ "$ETLS_COMBINED_STATUS" == "HEALTHY" ]]; then | ||
info "All ETLs are in a healthy status." | ||
else | ||
etl_failure | ||
fi | ||
else | ||
info "PlexTrac API container not running, skipping ETL status check" | ||
fi | ||
else | ||
info "PlexTrac API container not running, skipping ETL status check" | ||
error "Skipping ETL status check" | ||
Comment on lines
208
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And these two lines Your drunk Git, go home |
||
fi | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this line