summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpod/runtime.go5
-rw-r--r--libpod/runtime_ctr.go14
-rw-r--r--pkg/api/handlers/compat/version.go43
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_system.py9
-rw-r--r--test/e2e/network_connect_disconnect_test.go8
-rw-r--r--test/e2e/run_networking_test.go1
6 files changed, 61 insertions, 19 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 1f403790f..c5f5db531 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -951,6 +951,11 @@ func (r *Runtime) GetOCIRuntimePath() string {
return r.defaultOCIRuntime.Path()
}
+// DefaultOCIRuntime return copy of Default OCI Runtime
+func (r *Runtime) DefaultOCIRuntime() OCIRuntime {
+ return r.defaultOCIRuntime
+}
+
// StorageConfig retrieves the storage options for the container runtime
func (r *Runtime) StorageConfig() storage.StoreOptions {
return r.storageConfig
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 059f56798..02bbb6981 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -246,6 +246,20 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
ctr.config.Networks = netNames
}
+ // https://github.com/containers/podman/issues/11285
+ // normalize the networks aliases to use network names and never ids
+ if len(ctr.config.NetworkAliases) > 0 {
+ netAliases := make(map[string][]string, len(ctr.config.NetworkAliases))
+ for nameOrID, aliases := range ctr.config.NetworkAliases {
+ netName, err := network.NormalizeName(r.config, nameOrID)
+ if err != nil {
+ return nil, err
+ }
+ netAliases[netName] = aliases
+ }
+ ctr.config.NetworkAliases = netAliases
+ }
+
// Inhibit shutdown until creation succeeds
shutdown.Inhibit()
defer shutdown.Uninhibit()
diff --git a/pkg/api/handlers/compat/version.go b/pkg/api/handlers/compat/version.go
index f1cd77a9a..a115cc885 100644
--- a/pkg/api/handlers/compat/version.go
+++ b/pkg/api/handlers/compat/version.go
@@ -13,20 +13,19 @@ import (
"github.com/containers/podman/v3/pkg/domain/entities/types"
"github.com/containers/podman/v3/version"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
)
func VersionHandler(w http.ResponseWriter, r *http.Request) {
- // 200 ok
- // 500 internal
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- versionInfo, err := define.GetVersion()
+ running, err := define.GetVersion()
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err)
return
}
- infoData, err := runtime.Info()
+ info, err := runtime.Info()
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to obtain system memory info"))
return
@@ -34,20 +33,40 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
components := []types.ComponentVersion{{
Name: "Podman Engine",
- Version: versionInfo.Version,
+ Version: running.Version,
Details: map[string]string{
"APIVersion": version.APIVersion[version.Libpod][version.CurrentAPI].String(),
"Arch": goRuntime.GOARCH,
- "BuildTime": time.Unix(versionInfo.Built, 0).Format(time.RFC3339),
- "Experimental": "true",
- "GitCommit": versionInfo.GitCommit,
- "GoVersion": versionInfo.GoVersion,
- "KernelVersion": infoData.Host.Kernel,
+ "BuildTime": time.Unix(running.Built, 0).Format(time.RFC3339),
+ "Experimental": "false",
+ "GitCommit": running.GitCommit,
+ "GoVersion": running.GoVersion,
+ "KernelVersion": info.Host.Kernel,
"MinAPIVersion": version.APIVersion[version.Libpod][version.MinimalAPI].String(),
"Os": goRuntime.GOOS,
},
}}
+ if conmon, oci, err := runtime.DefaultOCIRuntime().RuntimeInfo(); err != nil {
+ logrus.Warnf("Failed to retrieve Conmon and OCI Information: %q", err.Error())
+ } else {
+ additional := []types.ComponentVersion{
+ {
+ Name: "Conmon",
+ Version: conmon.Version,
+ Details: map[string]string{
+ "Package": conmon.Package,
+ }},
+ {
+ Name: fmt.Sprintf("OCI Runtime (%s)", oci.Name),
+ Version: oci.Version,
+ Details: map[string]string{
+ "Package": oci.Package,
+ }},
+ }
+ components = append(components, additional...)
+ }
+
apiVersion := version.APIVersion[version.Compat][version.CurrentAPI]
minVersion := version.APIVersion[version.Compat][version.MinimalAPI]
@@ -56,13 +75,13 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
Platform: struct {
Name string
}{
- Name: fmt.Sprintf("%s/%s/%s-%s", goRuntime.GOOS, goRuntime.GOARCH, infoData.Host.Distribution.Distribution, infoData.Host.Distribution.Version),
+ Name: fmt.Sprintf("%s/%s/%s-%s", goRuntime.GOOS, goRuntime.GOARCH, info.Host.Distribution.Distribution, info.Host.Distribution.Version),
},
APIVersion: fmt.Sprintf("%d.%d", apiVersion.Major, apiVersion.Minor),
Arch: components[0].Details["Arch"],
BuildTime: components[0].Details["BuildTime"],
Components: components,
- Experimental: true,
+ Experimental: false,
GitCommit: components[0].Details["GitCommit"],
GoVersion: components[0].Details["GoVersion"],
KernelVersion: components[0].Details["KernelVersion"],
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_system.py b/test/apiv2/python/rest_api/test_v2_0_0_system.py
index 3628b5af1..3dfd08525 100644
--- a/test/apiv2/python/rest_api/test_v2_0_0_system.py
+++ b/test/apiv2/python/rest_api/test_v2_0_0_system.py
@@ -70,6 +70,15 @@ class SystemTestCase(APITestCase):
r = requests.get(self.uri("/version"))
self.assertEqual(r.status_code, 200, r.text)
+ body = r.json()
+ names = [d.get("Name", "") for d in body["Components"]]
+
+ self.assertIn("Conmon", names)
+ for n in names:
+ if n.startswith("OCI Runtime"):
+ oci_name = n
+ self.assertIsNotNone(oci_name, "OCI Runtime not found in version components.")
+
def test_df(self):
r = requests.get(self.podman_url + "/v1.40/system/df")
self.assertEqual(r.status_code, 200, r.text)
diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go
index b1f3607ab..217efdeec 100644
--- a/test/e2e/network_connect_disconnect_test.go
+++ b/test/e2e/network_connect_disconnect_test.go
@@ -236,8 +236,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
})
It("podman network connect and run with network ID", func() {
- SkipIfRemote("remote flakes to much I will fix this in another PR")
- SkipIfRootless("network connect and disconnect are only rootful")
netName := "ID" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
@@ -249,7 +247,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(session).Should(Exit(0))
netID := session.OutputToString()
- ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netID, ALPINE, "top"})
+ ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netID, "--network-alias", "somealias", ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0))
@@ -269,7 +267,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(session).Should(Exit(0))
newNetID := session.OutputToString()
- connect := podmanTest.Podman([]string{"network", "connect", newNetID, "test"})
+ connect := podmanTest.Podman([]string{"network", "connect", "--alias", "secondalias", newNetID, "test"})
connect.WaitWithDefaultTimeout()
Expect(connect).Should(Exit(0))
@@ -324,8 +322,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
})
It("podman network disconnect and run with network ID", func() {
- SkipIfRemote("remote flakes to much I will fix this in another PR")
- SkipIfRootless("network connect and disconnect are only rootful")
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 92388b099..8eabeba97 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -764,7 +764,6 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run check dnsname adds dns search domain", func() {
- Skip("needs dnsname#57")
net := "dnsname" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()