gandi.cli
gandi.cli copied to clipboard
add json format when listing vms
This PR aims to add JSON output and some network information when listing VM.
So, you can customize the default text output using jq
such as:
(gandi.cli) $ cat /tmp/vm_info.jq
{
"hostname": .hostname,
"ips": [
.ifaces[].ips[].ip
]
}
(gandi.cli) $ gandi vm list --format json | jq -f /tmp/vm_info.jq
{
"hostname": "test-sd5",
"ips": [
"46.xxx.xxx.xxx",
"2001:4b98:xxx"
]
}
{
"hostname": "test-sd6",
"ips": [
"46.xxx.xxx.xxx",
"2001:4b98:xxx"
]
}
Pretty useful to avoid loop over gandi vm info <resource>
output to just gather basic network information.
Coverage increased (+0.008%) to 90.751% when pulling 24e8b5960c2493a70637708fc35c79eda8ceb863 on bib0x:vm-list-json-output into bfe2e6f44135b7fbac50f9f44b5e58577583d07d on Gandi:master.
+1 LGTM