capsul-flask/capsulflask/shell_scripts/virsh-net-list.sh

14 lines
442 B
Bash
Executable File

#!/bin/sh
printf '['
delimiter=""
virsh net-list --all | tail -n +3 | awk '{ print $1 }' | while read -r network_name; do
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=","
done
printf '\n]\n'