mirror of
https://github.com/containers/podman.git
synced 2025-07-31 12:22:29 +08:00
Always show RemoteSocket.Exists in json
The `Exists` field of the `RemoteSocket` struct is marshaled to json with the `omitempty` setting. This has the disadvantage that by default `podman info` shows a `remotePath` entry (the remote path is set in `pkg/domain/infra/abi/systems.go`: `(*ContainerEngine).Info`) but not that this path does not exist: ``` ❯ podman info --format json | jq .host.remoteSocket { "path": "/run/user/1000/podman/podman.sock" } ``` By removing the `omitempty`, we ensure that the existence is always shown: ``` ❯ bin/podman info --format json | jq .host.remoteSocket { "path": "/run/user/1000/podman/podman.sock", "exists": false } ``` Signed-off-by: Dan Čermák <dcermak@suse.com>
This commit is contained in:
@ -68,7 +68,7 @@ type HostInfo struct {
|
||||
// RemoteSocket describes information about the API socket
|
||||
type RemoteSocket struct {
|
||||
Path string `json:"path,omitempty"`
|
||||
Exists bool `json:"exists,omitempty"`
|
||||
Exists bool `json:"exists"`
|
||||
}
|
||||
|
||||
// SlirpInfo describes the slirp executable that is being used
|
||||
|
@ -118,6 +118,8 @@ var _ = Describe("Podman Info", func() {
|
||||
Expect(session).Should(Exit(0))
|
||||
if IsRemote() {
|
||||
Expect(session.OutputToString()).To(ContainSubstring("true"))
|
||||
} else {
|
||||
Expect(session.OutputToString()).To(ContainSubstring("false"))
|
||||
}
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user