aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-07-16 14:58:08 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-07-16 14:58:08 +0200
commit6f1c7a0b6b5a5cb4eb830758653f307fece8b08d (patch)
treebfa324561ee2b55c9dd5328215e4d615639dcc77
parentce28dc3c4c3dba468ddb6f2a249c0c4bfc058805 (diff)
downloadpodman-6f1c7a0b6b5a5cb4eb830758653f307fece8b08d.tar.gz
podman-6f1c7a0b6b5a5cb4eb830758653f307fece8b08d.tar.bz2
podman-6f1c7a0b6b5a5cb4eb830758653f307fece8b08d.zip
systemd: require network*-online*.target
Require the network to be online in all (generated) systemd units to make sure that containers and Podman run only after the network has been fully configured. Fixes: #10655 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
-rw-r--r--contrib/systemd/auto-update/podman-auto-update.service2
-rw-r--r--docs/source/markdown/podman-generate-systemd.1.md6
-rw-r--r--pkg/systemd/generate/common.go2
-rw-r--r--pkg/systemd/generate/containers_test.go34
-rw-r--r--pkg/systemd/generate/pods_test.go10
-rw-r--r--test/system/255-auto-update.bats2
6 files changed, 28 insertions, 28 deletions
diff --git a/contrib/systemd/auto-update/podman-auto-update.service b/contrib/systemd/auto-update/podman-auto-update.service
index 9376db225..dc5fac8cf 100644
--- a/contrib/systemd/auto-update/podman-auto-update.service
+++ b/contrib/systemd/auto-update/podman-auto-update.service
@@ -1,7 +1,7 @@
[Unit]
Description=Podman auto-update service
Documentation=man:podman-auto-update(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
[Service]
diff --git a/docs/source/markdown/podman-generate-systemd.1.md b/docs/source/markdown/podman-generate-systemd.1.md
index 28c455b78..357120381 100644
--- a/docs/source/markdown/podman-generate-systemd.1.md
+++ b/docs/source/markdown/podman-generate-systemd.1.md
@@ -73,7 +73,7 @@ $ podman generate systemd --restart-policy=always -t 1 nginx
[Unit]
Description=Podman container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/container/storage
@@ -102,7 +102,7 @@ $ sudo podman generate systemd --new --files --name bb310a0780ae
[Unit]
Description=Podman container-busy_moser.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/container/storage
@@ -144,7 +144,7 @@ Description=Podman pod-systemd-pod.service
Documentation=man:podman-generate-systemd(1)
Requires=container-amazing_chandrasekhar.service container-jolly_shtern.service
Before=container-amazing_chandrasekhar.service container-jolly_shtern.service
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/container/storage
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go
index e183125a7..349805980 100644
--- a/pkg/systemd/generate/common.go
+++ b/pkg/systemd/generate/common.go
@@ -34,7 +34,7 @@ const headerTemplate = `# {{{{.ServiceName}}}}.service
[Unit]
Description=Podman {{{{.ServiceName}}}}.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor={{{{.RunRoot}}}}
`
diff --git a/pkg/systemd/generate/containers_test.go b/pkg/systemd/generate/containers_test.go
index 12a8f3004..1d24cc4a9 100644
--- a/pkg/systemd/generate/containers_test.go
+++ b/pkg/systemd/generate/containers_test.go
@@ -46,7 +46,7 @@ func TestCreateContainerSystemdUnit(t *testing.T) {
[Unit]
Description=Podman container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -72,7 +72,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman container-foobar.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -96,7 +96,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman container-foobar.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
BindsTo=a.service b.service c.service pod.service
@@ -122,7 +122,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -144,7 +144,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -166,7 +166,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -188,7 +188,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -210,7 +210,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -233,7 +233,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -259,7 +259,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -281,7 +281,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -303,7 +303,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -325,7 +325,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -347,7 +347,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -369,7 +369,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -391,7 +391,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -413,7 +413,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
diff --git a/pkg/systemd/generate/pods_test.go b/pkg/systemd/generate/pods_test.go
index a11e1e11e..4b8a9ffd5 100644
--- a/pkg/systemd/generate/pods_test.go
+++ b/pkg/systemd/generate/pods_test.go
@@ -45,7 +45,7 @@ func TestCreatePodSystemdUnit(t *testing.T) {
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -73,7 +73,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -101,7 +101,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -129,7 +129,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -157,7 +157,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats
index 5e2d66af9..a73ed94e8 100644
--- a/test/system/255-auto-update.bats
+++ b/test/system/255-auto-update.bats
@@ -249,7 +249,7 @@ EOF
[Unit]
Description=Podman auto-update testing service
Documentation=man:podman-auto-update(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
[Service]