diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-24 03:13:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-24 03:13:25 +0100 |
commit | cc4adddeb77ef38ecd36be04e95685b2e7b8b86c (patch) | |
tree | 9dffece816ad32c2c0b7651cb7c88be70954a88f /pkg/adapter/info_remote.go | |
parent | 8e4be923b83aadfaa58569326119890ed9c1d459 (diff) | |
parent | 4bf973a9f61eae3b02925a42ccfa784baeb917dc (diff) | |
download | podman-cc4adddeb77ef38ecd36be04e95685b2e7b8b86c.tar.gz podman-cc4adddeb77ef38ecd36be04e95685b2e7b8b86c.tar.bz2 podman-cc4adddeb77ef38ecd36be04e95685b2e7b8b86c.zip |
Merge pull request #2413 from baude/remotepodstop
Enable more podman-remote pod commands
Diffstat (limited to 'pkg/adapter/info_remote.go')
-rw-r--r-- | pkg/adapter/info_remote.go | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pkg/adapter/info_remote.go b/pkg/adapter/info_remote.go new file mode 100644 index 000000000..3b691ed17 --- /dev/null +++ b/pkg/adapter/info_remote.go @@ -0,0 +1,56 @@ +// +build remoteclient + +package adapter + +import ( + "encoding/json" + + "github.com/containers/libpod/cmd/podman/varlink" + "github.com/containers/libpod/libpod" +) + +// Info returns information for the host system and its components +func (r RemoteRuntime) Info() ([]libpod.InfoData, error) { + // TODO the varlink implementation for info should be updated to match the output for regular info + var ( + reply []libpod.InfoData + hostInfo map[string]interface{} + store map[string]interface{} + ) + + registries := make(map[string]interface{}) + insecureRegistries := make(map[string]interface{}) + conn, err := r.Connect() + if err != nil { + return nil, err + } + defer conn.Close() + info, err := iopodman.GetInfo().Call(conn) + if err != nil { + return nil, err + } + + // info.host -> map[string]interface{} + h, err := json.Marshal(info.Host) + if err != nil { + return nil, err + } + json.Unmarshal(h, &hostInfo) + + // info.store -> map[string]interface{} + s, err := json.Marshal(info.Store) + if err != nil { + return nil, err + } + json.Unmarshal(s, &store) + + registries["registries"] = info.Registries + insecureRegistries["registries"] = info.Insecure_registries + + // Add everything to the reply + reply = append(reply, libpod.InfoData{Type: "host", Data: hostInfo}) + reply = append(reply, libpod.InfoData{Type: "registries", Data: registries}) + reply = append(reply, libpod.InfoData{Type: "insecure registries", Data: insecureRegistries}) + reply = append(reply, libpod.InfoData{Type: "store", Data: store}) + return reply, nil +} |