fix for ubuntu 24.04

This commit is contained in:
Sebastian
2025-01-04 01:30:24 +01:00
parent d3ccc28d2c
commit 5169fe0751

View File

@@ -9,19 +9,16 @@ while IFS= read -r line; do
blacklist+=("$line")
done < "$BASEPATH/path-blacklist.txt"
y2j() {
python3 -c 'import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin.read())))' < "$1"
}
# Parse Docker Compose file to get all services
services=$(y2j $BASEPATH/$1.yml | jq -r '.services | keys | .[]')
services=$(cat $BASEPATH/$1.yml | yaml2json | jq -r '.services | keys | .[]')
echo $services
for service in $services; do
IFS=$'\t' read -r -a labels <<< $(y2j "$BASEPATH/$1.yml" | jq -r ".services[\"$service\"].labels | @tsv")
IFS=$'\t' read -r -a labels <<< $(cat "$BASEPATH/$1.yml" | yaml2json | jq -r ".services[\"$service\"].labels[]")
for label in "${labels[@]}"; do
if [[ "$label" == *"stripprefix.prefixes"* ]]; then
echo $label
path=$(echo "$label" | cut -d "=" -f 2)
break # Stop looping after finding the first match
fi