Skip to content
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

Fix mutagen.sh to work with mutagen version 0.15.0 up #759

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/_base/harness/scripts/mutagen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ clean_existing_projects()
local SYNC_LIST
for SYNC_NAME in "${SYNC_NAMES[@]}"; do
# List syncs based on name
SYNC_LIST="$(mutagen sync list "$SYNC_NAME" 2> /dev/null || true)"
SYNC_LIST="$(mutagen sync list -l "$SYNC_NAME" 2> /dev/null || true)"
# Check if there are entries left
if [ "$(echo "$SYNC_LIST" | grep --count "URL: $(pwd)" | awk '{ print $1 }')" -gt 0 ]; then
# Build an array of sync session IDs to clean up
while IFS='' read -r line; do EXISTING_PROJECT_LABELS+=("$line"); done < <(echo "$SYNC_LIST" | grep -B4 "URL: $(pwd)" | grep io.mutagen.project | awk '{print $1"="$2}' | sed s/:=/=/)
while IFS='' read -r line; do EXISTING_PROJECT_LABELS+=("$line"); done < <(echo "$SYNC_LIST" | grep -A6 "^Name: $SYNC_NAME$" | grep io.mutagen.project | awk '{print $1"="$2}' | sed s/:=/=/)
fi
done

Expand All @@ -100,11 +100,11 @@ clean_existing_projects()
CONTAINER_NAMES_REGEX="$(join_by_character "\|" "${CONTAINER_NAMES[@]}")"
for FORWARD_NAME in "${FORWARD_NAMES[@]}"; do
# List forwards based on name
FORWARD_LIST="$(mutagen forward list "$FORWARD_NAME" 2> /dev/null || true)"
FORWARD_LIST="$(mutagen forward list -l "$FORWARD_NAME" 2> /dev/null || true)"
# Check if there are entries left
if [ "$(echo "$FORWARD_LIST" | grep --count "URL: docker://\($CONTAINER_NAMES_REGEX\):tcp:" | awk '{ print $1 }')" -gt 0 ]; then
# Build an array of sync session IDs to clean up
while IFS='' read -r line; do EXISTING_PROJECT_LABELS+=("$line"); done < <(echo "$FORWARD_LIST" | grep -B6 "URL: docker://\($CONTAINER_NAMES_REGEX\):tcp:" | grep io.mutagen.project | awk '{print $1"="$2}' | sed s/:=/=/)
while IFS='' read -r line; do EXISTING_PROJECT_LABELS+=("$line"); done < <(echo "$FORWARD_LIST" | grep -B10 "URL: docker://\($CONTAINER_NAMES_REGEX\):tcp:" | grep io.mutagen.project | awk '{print $1"="$2}' | sed s/:=/=/)
fi
done

Expand Down