dustin
/
zdotdir
Archived
1
0
Fork 0

functions/vmip: Correctly handle multiple addresses

When a virtual machine has multiple matching addresses, only the first
will be printed.
master
Dustin 2017-02-27 10:40:39 -06:00
parent fa73cd6482
commit 04ce9e66e3
1 changed files with 1 additions and 1 deletions

View File

@ -1,2 +1,2 @@
virsh qemu-agent-command $1 '{"execute":"guest-network-get-interfaces"}' \
| jq -r '.return | .[] | select(.name=="eth0") | .["ip-addresses"] | .[] | select(.["ip-address-type"] == "ipv6" and (.["ip-address"]|startswith("fe80")|not)) | .["ip-address"]'
| jq -r '.return | .[] | select(.name=="eth0") | .["ip-addresses"] | map(select(.["ip-address-type"] == "ipv6" and (.["ip-address"]|startswith("fe80")|not)))[0]["ip-address"]'