Add format to podman machine info

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2023-03-13 15:56:05 -04:00
parent 581611844d
commit 71bcd9891d

View File

@ -17,6 +17,11 @@ Rootless only, as all `podman machine` commands can be only be used with rootles
Change output format to "json" or a Go template.
| **Placeholder** | **Description** |
| ------------------- | --------------------------------- |
| .Host ... | Host information for local machine|
| .Version ... | Version of the machine |
#### **--help**
Print usage statement.
@ -25,8 +30,60 @@ Print usage statement.
```
$ podman machine info
Host:
Arch: amd64
CurrentMachine: ""
DefaultMachine: ""
EventsDir: /run/user/3267/podman
MachineConfigDir: /home/myusername/.config/containers/podman/machine/qemu
MachineImageDir: /home/myusername/.local/share/containers/podman/machine/qemu
MachineState: ""
NumberOfMachines: 0
OS: linux
VMType: qemu
Version:
APIVersion: 4.4.0
Built: 1677097848
BuiltTime: Wed Feb 22 15:30:48 2023
GitCommit: aa196c0d5c9abd5800edf9e27587c60343a26c2b-dirty
GoVersion: go1.20
Os: linux
OsArch: linux/amd64
Version: 4.4.0
```
```
$ podman machine info --format json
$ podman machine info --format {{.Host.Arch}}
{
"Host": {
"Arch": "amd64",
"CurrentMachine": "",
"DefaultMachine": "",
"EventsDir": "/run/user/3267/podman",
"MachineConfigDir": "/home/myusername/.config/containers/podman/machine/qemu",
"MachineImageDir": "/home/myusername/.local/share/containers/podman/machine/qemu",
"MachineState": "",
"NumberOfMachines": 0,
"OS": "linux",
"VMType": "qemu"
},
"Version": {
"APIVersion": "4.4.0",
"Version": "4.4.0",
"GoVersion": "go1.20",
"GitCommit": "aa196c0d5c9abd5800edf9e27587c60343a26c2b-dirty",
"BuiltTime": "Wed Feb 22 15:30:48 2023",
"Built": 1677097848,
"OsArch": "linux/amd64",
"Os": "linux"
}
}
```
```
$ podman machine info --format "{{ .Host.Arch }}"
amd64
```
## SEE ALSO