-
Notifications
You must be signed in to change notification settings - Fork 227
How to use Go template to fetch data from ignite inspect output? #587
Comments
Hi, thanks for opening an issue for this. It may be a good idea to add some examples in the command help, similar to the example usage in ignite ps command for using filters. Ignite APIs are based on k8s api machinery. The API definition can be found here. Based on that, since it's go template, you can do something like:
Hope this helps. |
Thanks for your help, the command works well. It is amazing that it can not work correctly if I just put the '-t' before specific the vm I want to inspect. |
@zhuangh7 We're going to open a bug and patch the command to add some examples in the command help text. Thanks for opening this up and asking :) (Yes, the flag ordering thing with cobra style CLI's and positional args can be funky to use. I struggle with this when editing commands with docker and kubectl as well which have the same usage) |
Thanks for your contribution, it can be really helpful :> |
Hi there, I'm not familar with Go template and I try to use '-t' of ignite inspect command.
I used to use Go template in docker inspect, and I can use command like:
docker inspect --format {{.NetworkSettings.Networks.bridge.IPAddress}} 1564bdd87437
to get the ip of the container
But when I use command like:
sudo ignite inspect -t '{{.status.ipAddresses}}' vm 24
it just response with an error:
FATA[0000] failed rendering template: template: :1:9: executing "" at <.status.ipAddresses>: can't evaluate field status in type *ignite.VM
Could you please give me some idea about how to use Go timeplate here?
Thank you!
The text was updated successfully, but these errors were encountered: