summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-01-06 17:00:21 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2020-01-07 19:38:46 -0500
commitd52a4dc2d48e0c660fea1449e9d24aa4acf5fe8a (patch)
treee03909f81a8774aa4e231e1895d43d635692de04 /pkg
parentc41fd09a8da3a96bc0e58f9f29f87b9bdf30264d (diff)
downloadpodman-d52a4dc2d48e0c660fea1449e9d24aa4acf5fe8a.tar.gz
podman-d52a4dc2d48e0c660fea1449e9d24aa4acf5fe8a.tar.bz2
podman-d52a4dc2d48e0c660fea1449e9d24aa4acf5fe8a.zip
Fix podman-remote info to show registry data
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/info_remote.go14
-rw-r--r--pkg/varlinkapi/system.go29
2 files changed, 23 insertions, 20 deletions
diff --git a/pkg/adapter/info_remote.go b/pkg/adapter/info_remote.go
index 3170e5b3d..c55d1f6ef 100644
--- a/pkg/adapter/info_remote.go
+++ b/pkg/adapter/info_remote.go
@@ -14,12 +14,11 @@ func (r RemoteRuntime) Info() ([]define.InfoData, error) {
// TODO the varlink implementation for info should be updated to match the output for regular info
var (
reply []define.InfoData
+ regInfo map[string]interface{}
hostInfo map[string]interface{}
store map[string]interface{}
)
- registries := make(map[string]interface{})
- insecureRegistries := make(map[string]interface{})
info, err := iopodman.GetInfo().Call(r.Conn)
if err != nil {
return nil, err
@@ -39,13 +38,16 @@ func (r RemoteRuntime) Info() ([]define.InfoData, error) {
}
json.Unmarshal(s, &store)
- registries["registries"] = info.Registries
- insecureRegistries["registries"] = info.Insecure_registries
+ // info.Registries -> map[string]interface{}
+ reg, err := json.Marshal(info.Registries)
+ if err != nil {
+ return nil, err
+ }
+ json.Unmarshal(reg, &regInfo)
// Add everything to the reply
reply = append(reply, define.InfoData{Type: "host", Data: hostInfo})
- reply = append(reply, define.InfoData{Type: "registries", Data: registries})
- reply = append(reply, define.InfoData{Type: "insecure registries", Data: insecureRegistries})
+ reply = append(reply, define.InfoData{Type: "registries", Data: regInfo})
reply = append(reply, define.InfoData{Type: "store", Data: store})
return reply, nil
}
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index b81ff11ba..50aaaaa44 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -9,6 +9,7 @@ import (
goruntime "runtime"
"time"
+ "github.com/containers/image/v5/pkg/sysregistriesv2"
"github.com/containers/libpod/cmd/podman/varlink"
"github.com/containers/libpod/libpod/define"
"github.com/sirupsen/logrus"
@@ -37,9 +38,6 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
if err != nil {
return err
}
- var (
- registries, insecureRegistries []string
- )
podmanInfo := iopodman.PodmanInfo{}
info, err := i.Runtime.Info()
if err != nil {
@@ -90,22 +88,25 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
Graph_status: graphStatus,
}
+ // Registry information if any is stored as the second list item
if len(info) > 2 {
- registriesInterface := info[2].Data["registries"]
- if registriesInterface != nil {
- registries = registriesInterface.([]string)
- }
- }
- if len(info) > 3 {
- insecureRegistriesInterface := info[3].Data["registries"]
- if insecureRegistriesInterface != nil {
- insecureRegistries = insecureRegistriesInterface.([]string)
+ 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)
+ }
}
+
}
podmanInfo.Store = infoStore
podmanInfo.Podman = pmaninfo
- podmanInfo.Registries = registries
- podmanInfo.Insecure_registries = insecureRegistries
return call.ReplyGetInfo(podmanInfo)
}