Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

add json format when listing vms #312

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bib0x
Copy link

@bib0x bib0x commented May 3, 2021

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.

@coveralls
Copy link

coveralls commented May 3, 2021

Coverage Status

Coverage increased (+0.008%) to 90.751% when pulling 24e8b59 on bib0x:vm-list-json-output into bfe2e6f on Gandi:master.

@aegiap
Copy link
Contributor

aegiap commented May 5, 2021

+1 LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants