summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r--pkg/varlinkapi/attach.go8
-rw-r--r--pkg/varlinkapi/system.go73
2 files changed, 38 insertions, 43 deletions
diff --git a/pkg/varlinkapi/attach.go b/pkg/varlinkapi/attach.go
index 94f4d653e..34f351669 100644
--- a/pkg/varlinkapi/attach.go
+++ b/pkg/varlinkapi/attach.go
@@ -16,7 +16,7 @@ import (
"k8s.io/client-go/tools/remotecommand"
)
-func setupStreams(call iopodman.VarlinkCall) (*bufio.Reader, *bufio.Writer, *io.PipeReader, *io.PipeWriter, *libpod.AttachStreams) {
+func setupStreams(call iopodman.VarlinkCall) (*bufio.Reader, *bufio.Writer, *io.PipeReader, *io.PipeWriter, *define.AttachStreams) {
// These are the varlink sockets
reader := call.Call.Reader
@@ -30,7 +30,7 @@ func setupStreams(call iopodman.VarlinkCall) (*bufio.Reader, *bufio.Writer, *io.
// TODO if runc ever starts passing stderr, we can too
// stderrWriter := NewVirtWriteCloser(writer, ToStderr)
- streams := libpod.AttachStreams{
+ streams := define.AttachStreams{
OutputStream: stdoutWriter,
InputStream: bufio.NewReader(pr),
// Runc eats the error stream
@@ -117,7 +117,7 @@ func (i *LibpodAPI) Attach(call iopodman.VarlinkCall, name string, detachKeys st
return call.Writer.Flush()
}
-func attach(ctr *libpod.Container, streams *libpod.AttachStreams, detachKeys string, resize chan remotecommand.TerminalSize, errChan chan error) error {
+func attach(ctr *libpod.Container, streams *define.AttachStreams, detachKeys string, resize chan remotecommand.TerminalSize, errChan chan error) error {
go func() {
if err := ctr.Attach(streams, detachKeys, resize); err != nil {
errChan <- err
@@ -127,7 +127,7 @@ func attach(ctr *libpod.Container, streams *libpod.AttachStreams, detachKeys str
return attachError
}
-func startAndAttach(ctr *libpod.Container, streams *libpod.AttachStreams, detachKeys string, resize chan remotecommand.TerminalSize, errChan chan error) error {
+func startAndAttach(ctr *libpod.Container, streams *define.AttachStreams, detachKeys string, resize chan remotecommand.TerminalSize, errChan chan error) error {
var finalErr error
attachChan, err := ctr.StartAndAttach(getContext(), streams, detachKeys, resize, false)
if err != nil {
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index 04fb9f648..7bee643c2 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -44,28 +44,26 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
return call.ReplyErrorOccurred(err.Error())
}
- host := info[0].Data
distribution := iopodman.InfoDistribution{
- Distribution: host["Distribution"].(map[string]interface{})["distribution"].(string),
- Version: host["Distribution"].(map[string]interface{})["version"].(string),
+ Distribution: info.Host.Distribution.Distribution,
+ Version: info.Host.Distribution.Version,
}
infoHost := iopodman.InfoHost{
- Buildah_version: host["BuildahVersion"].(string),
+ Buildah_version: info.Host.BuildahVersion,
Distribution: distribution,
- Mem_free: host["MemFree"].(int64),
- Mem_total: host["MemTotal"].(int64),
- Swap_free: host["SwapFree"].(int64),
- Swap_total: host["SwapTotal"].(int64),
- Arch: host["arch"].(string),
- Cpus: int64(host["cpus"].(int)),
- Hostname: host["hostname"].(string),
- Kernel: host["kernel"].(string),
- Os: host["os"].(string),
- Uptime: host["uptime"].(string),
- Eventlogger: host["eventlogger"].(string),
+ Mem_free: info.Host.MemFree,
+ Mem_total: info.Host.MemTotal,
+ Swap_free: info.Host.SwapFree,
+ Swap_total: info.Host.SwapTotal,
+ Arch: info.Host.Arch,
+ Cpus: int64(info.Host.CPUs),
+ Hostname: info.Host.Hostname,
+ Kernel: info.Host.Kernel,
+ Os: info.Host.OS,
+ Uptime: info.Host.Uptime,
+ Eventlogger: info.Host.EventLogger,
}
podmanInfo.Host = infoHost
- store := info[1].Data
pmaninfo := iopodman.InfoPodmanBinary{
Compiler: goruntime.Compiler,
Go_version: goruntime.Version(),
@@ -74,36 +72,33 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
}
graphStatus := iopodman.InfoGraphStatus{
- Backing_filesystem: store["GraphStatus"].(map[string]string)["Backing Filesystem"],
- Native_overlay_diff: store["GraphStatus"].(map[string]string)["Native Overlay Diff"],
- Supports_d_type: store["GraphStatus"].(map[string]string)["Supports d_type"],
+ Backing_filesystem: info.Store.GraphStatus["Backing Filesystem"],
+ Native_overlay_diff: info.Store.GraphStatus["Native Overlay Diff"],
+ Supports_d_type: info.Store.GraphStatus["Supports d_type"],
}
infoStore := iopodman.InfoStore{
- Graph_driver_name: store["GraphDriverName"].(string),
- Containers: int64(store["ContainerStore"].(map[string]interface{})["number"].(int)),
- Images: int64(store["ImageStore"].(map[string]interface{})["number"].(int)),
- Run_root: store["RunRoot"].(string),
- Graph_root: store["GraphRoot"].(string),
- Graph_driver_options: fmt.Sprintf("%v", store["GraphOptions"]),
+ Graph_driver_name: info.Store.GraphDriverName,
+ Containers: int64(info.Store.ContainerStore.Number),
+ Images: int64(info.Store.ImageStore.Number),
+ Run_root: info.Store.RunRoot,
+ Graph_root: info.Store.GraphRoot,
+ Graph_driver_options: fmt.Sprintf("%v", info.Store.GraphOptions),
Graph_status: graphStatus,
}
// Registry information if any is stored as the second list item
- if len(info) > 2 {
- for key, val := range info[2].Data {
- if key == "search" {
- podmanInfo.Registries.Search = val.([]string)
- continue
- }
- regData := val.(sysregistriesv2.Registry)
- if regData.Insecure {
- podmanInfo.Registries.Insecure = append(podmanInfo.Registries.Insecure, key)
- }
- if regData.Blocked {
- podmanInfo.Registries.Blocked = append(podmanInfo.Registries.Blocked, key)
- }
+ for key, val := range info.Registries {
+ if key == "search" {
+ podmanInfo.Registries.Search = val.([]string)
+ continue
+ }
+ regData := val.(sysregistriesv2.Registry)
+ if regData.Insecure {
+ podmanInfo.Registries.Insecure = append(podmanInfo.Registries.Insecure, key)
+ }
+ if regData.Blocked {
+ podmanInfo.Registries.Blocked = append(podmanInfo.Registries.Blocked, key)
}
-
}
podmanInfo.Store = infoStore
podmanInfo.Podman = pmaninfo