summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-11-28 09:16:27 -0800
committerGitHub <noreply@github.com>2018-11-28 09:16:27 -0800
commit22d53e2b546e541646c8aec06fa4eb1f61904300 (patch)
tree7f64319d12ca1f6974736b5402840a63eb1784e2
parent88c23b0632518d5b1449b0cd2afa82f4bd53a287 (diff)
parent180d0c6f62af8fb18da2ddb0e929392ae3d389e6 (diff)
downloadpodman-22d53e2b546e541646c8aec06fa4eb1f61904300.tar.gz
podman-22d53e2b546e541646c8aec06fa4eb1f61904300.tar.bz2
podman-22d53e2b546e541646c8aec06fa4eb1f61904300.zip
Merge pull request #1798 from giuseppe/fix-notify-socket
systemd: fix NOTIFY_SOCKET with patched runc
-rw-r--r--libpod/oci.go3
-rw-r--r--test/e2e/run_test.go22
2 files changed, 21 insertions, 4 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index a8013aa47..6ca3ef2e6 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -591,6 +591,9 @@ func (r *OCIRuntime) startContainer(ctr *Container) error {
return err
}
env := []string{fmt.Sprintf("XDG_RUNTIME_DIR=%s", runtimeDir)}
+ if notify, ok := os.LookupEnv("NOTIFY_SOCKET"); ok {
+ env = append(env, fmt.Sprintf("NOTIFY_SOCKET=%s", notify))
+ }
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, env, r.path, "start", ctr.ID()); err != nil {
return err
}
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 4ed1fbed7..38504828b 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -3,6 +3,7 @@ package integration
import (
"fmt"
"io/ioutil"
+ "net"
"os"
"path/filepath"
"strings"
@@ -287,14 +288,27 @@ var _ = Describe("Podman run", func() {
})
It("podman run notify_socket", func() {
- sock := "/run/notify"
+ host := GetHostDistributionInfo()
+ if host.Distribution != "rhel" && host.Distribution != "centos" && host.Distribution != "fedora" {
+ Skip("this test requires a working runc")
+ }
+ sock := filepath.Join(podmanTest.TempDir, "notify")
+ addr := net.UnixAddr{
+ Name: sock,
+ Net: "unixgram",
+ }
+ socket, err := net.ListenUnixgram("unixgram", &addr)
+ Expect(err).To(BeNil())
+ defer os.Remove(sock)
+ defer socket.Close()
+
os.Setenv("NOTIFY_SOCKET", sock)
+ defer os.Unsetenv("NOTIFY_SOCKET")
+
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "NOTIFY_SOCKET"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- match, _ := session.GrepString(sock)
- Expect(match).Should(BeTrue())
- os.Unsetenv("NOTIFY_SOCKET")
+ Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
It("podman run log-opt", func() {