mirror of
https://github.com/containers/podman.git
synced 2025-10-14 17:55:51 +08:00
podman generate systemd: handle --sdnotify correctly
When a container was created with `--sdnotify value` we would remove this arg instead of using it like with `--sdnotfiy=value`. Also when the arg is set to ignore we should force conmon in order to make the resulting Type=notify units work. Fixes #15052 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -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")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user