functions/vmip: Correctly handle multiple addresses
When a virtual machine has multiple matching addresses, only the first will be printed.master
parent
fa73cd6482
commit
04ce9e66e3
|
@ -1,2 +1,2 @@
|
||||||
virsh qemu-agent-command $1 '{"execute":"guest-network-get-interfaces"}' \
|
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"]'
|
||||||
|
|
Reference in New Issue