2021-12-05 22:47:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-12-08 18:57:22 +00:00
|
|
|
|
|
|
|
printf '['
|
|
|
|
delimiter=""
|
|
|
|
virsh net-list --all | tail -n +3 | awk '{ print $1 }' | while read -r network_name; do
|
2021-12-09 18:46:07 +00:00
|
|
|
if [ "$network_name" != "" ]; then
|
2021-12-09 18:40:30 +00:00
|
|
|
virtual_bridge_name="$(virsh net-info "$network_name" | grep -E '^Bridge:' | awk '{ print $2 }')"
|
|
|
|
capsul_state="$(echo "$line" | sed -E 's/^ *[0-9-]+ +[^ ]+ +//')"
|
|
|
|
printf '%s\n {"name":"%s", "virtual_bridge_name":"%s"}' "$delimiter" "$network_name" "$virtual_bridge_name"
|
|
|
|
delimiter=","
|
|
|
|
fi
|
2021-12-08 18:57:22 +00:00
|
|
|
done
|
|
|
|
printf '\n]\n'
|
|
|
|
|