aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-01-09 10:40:20 +0100
committerGitHub <noreply@github.com>2020-01-09 10:40:20 +0100
commitf3fc10feb42930def6922fc050096ea38bafed7a (patch)
treeedf2dea05853dee9fb90bdfe3f07d3d810a0fe58
parentc99b413abbc74f6f7e126d8bca58f44a3fcd9c2d (diff)
parentd52a4dc2d48e0c660fea1449e9d24aa4acf5fe8a (diff)
downloadpodman-f3fc10feb42930def6922fc050096ea38bafed7a.tar.gz
podman-f3fc10feb42930def6922fc050096ea38bafed7a.tar.bz2
podman-f3fc10feb42930def6922fc050096ea38bafed7a.zip
Merge pull request #4802 from rhatdan/varlink
Fix podman-remote info to show registry data
-rwxr-xr-xAPI.md15
-rw-r--r--cmd/podman/varlink/io.podman.varlink10
-rw-r--r--pkg/adapter/info_remote.go14
-rw-r--r--pkg/varlinkapi/system.go29
-rw-r--r--test/e2e/info_test.go2
5 files changed, 43 insertions, 27 deletions
diff --git a/API.md b/API.md
index 05b08dc6f..283f4fc58 100755
--- a/API.md
+++ b/API.md
@@ -237,6 +237,8 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in
[type InfoPodmanBinary](#InfoPodmanBinary)
+[type InfoRegistry](#InfoRegistry)
+
[type InfoStore](#InfoStore)
[type KubePodService](#KubePodService)
@@ -1850,6 +1852,15 @@ go_version [string](https://godoc.org/builtin#string)
podman_version [string](https://godoc.org/builtin#string)
git_commit [string](https://godoc.org/builtin#string)
+### <a name="InfoRegistry"></a>type InfoRegistry
+
+InfoRegistry describes the host's registry information
+
+search [[]string](#[]string)
+
+insecure [[]string](#[]string)
+
+blocked [[]string](#[]string)
### <a name="InfoStore"></a>type InfoStore
InfoStore describes the host's storage informatoin
@@ -1962,9 +1973,7 @@ PodmanInfo describes the Podman host and build
host [InfoHost](#InfoHost)
-registries [[]string](#[]string)
-
-insecure_registries [[]string](#[]string)
+registries [InfoRegistry](#InfoRegistry)
store [InfoStore](#InfoStore)
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index e1f28d847..ac400a467 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -245,6 +245,13 @@ type InfoGraphStatus (
supports_d_type: string
)
+# InfoRegistry describes the host's registry information
+type InfoRegistry (
+ search: []string,
+ insecure: []string,
+ blocked: []string
+)
+
# InfoStore describes the host's storage informatoin
type InfoStore (
containers: int,
@@ -267,8 +274,7 @@ type InfoPodmanBinary (
# PodmanInfo describes the Podman host and build
type PodmanInfo (
host: InfoHost,
- registries: []string,
- insecure_registries: []string,
+ registries: InfoRegistry,
store: InfoStore,
podman: InfoPodmanBinary
)
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)
}
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index d3b1b974e..d16661d5b 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -1,5 +1,3 @@
-// +build !remoteclient
-
package integration
import (