summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/containers.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-01 11:34:17 +0200
committerGitHub <noreply@github.com>2022-08-01 11:34:17 +0200
commit271a9f45a462c652d4f025f583fc3bd204d95656 (patch)
treeb5a3b70333378b1893b14101f5740f9469845d6b /pkg/systemd/generate/containers.go
parentf5f7909932dc314612539dabf8682b17c6e20970 (diff)
parent6a9338ad6cb6c6c65fae7786b35636f260389ea9 (diff)
downloadpodman-271a9f45a462c652d4f025f583fc3bd204d95656.tar.gz
podman-271a9f45a462c652d4f025f583fc3bd204d95656.tar.bz2
podman-271a9f45a462c652d4f025f583fc3bd204d95656.zip
Merge pull request #15056 from Luap99/generate-systemd-sdnotify
podman generate systemd: handle --sdnotify correctly
Diffstat (limited to 'pkg/systemd/generate/containers.go')
-rw-r--r--pkg/systemd/generate/containers.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go
index 6596ef73b..66905202d 100644
--- a/pkg/systemd/generate/containers.go
+++ b/pkg/systemd/generate/containers.go
@@ -403,8 +403,13 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
// Default to --sdnotify=conmon unless already set by the
// container.
- hasSdnotifyParam := fs.Lookup("sdnotify").Changed
- if !hasSdnotifyParam {
+ sdnotifyFlag := fs.Lookup("sdnotify")
+ if !sdnotifyFlag.Changed {
+ startCommand = append(startCommand, "--sdnotify=conmon")
+ } else if sdnotifyFlag.Value.String() == libpodDefine.SdNotifyModeIgnore {
+ // If ignore is set force conmon otherwise the unit with Type=notify will fail.
+ logrus.Infof("Forcing --sdnotify=conmon for container %s", info.ContainerNameOrID)
+ remainingCmd = removeSdNotifyArg(remainingCmd, fs.NArg())
startCommand = append(startCommand, "--sdnotify=conmon")
}