diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-07 15:51:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-07 15:51:41 +0200 |
commit | 8a55363b80a012b6c6e774957ac477d0fd540a5e (patch) | |
tree | 97baa90a5f4364ff6731921649441407625fecd7 /pkg/systemd/generate/pods.go | |
parent | c20227bd16cae98247955b14f6dfea33a26c6a0b (diff) | |
parent | d1573b95e3427efae21da784e3112c5fb3d463fb (diff) | |
download | podman-8a55363b80a012b6c6e774957ac477d0fd540a5e.tar.gz podman-8a55363b80a012b6c6e774957ac477d0fd540a5e.tar.bz2 podman-8a55363b80a012b6c6e774957ac477d0fd540a5e.zip |
Merge pull request #11459 from vrothberg/fix-11438
generate systemd: handle --restart
Diffstat (limited to 'pkg/systemd/generate/pods.go')
-rw-r--r-- | pkg/systemd/generate/pods.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go index 1b92649e8..e755b8eea 100644 --- a/pkg/systemd/generate/pods.go +++ b/pkg/systemd/generate/pods.go @@ -217,7 +217,6 @@ func generatePodInfo(pod *libpod.Pod, options entities.GenerateSystemdOptions) ( info := podInfo{ ServiceName: serviceName, InfraNameOrID: ctrNameOrID, - RestartPolicy: options.RestartPolicy, PIDFile: conmonPidFile, StopTimeout: timeout, GenerateTimestamp: true, @@ -230,8 +229,12 @@ func generatePodInfo(pod *libpod.Pod, options entities.GenerateSystemdOptions) ( // that the podInfo is also post processed and completed, which allows for an // easier unit testing. func executePodTemplate(info *podInfo, options entities.GenerateSystemdOptions) (string, error) { - if err := validateRestartPolicy(info.RestartPolicy); err != nil { - return "", err + info.RestartPolicy = define.DefaultRestartPolicy + if options.RestartPolicy != nil { + if err := validateRestartPolicy(*options.RestartPolicy); err != nil { + return "", err + } + info.RestartPolicy = *options.RestartPolicy } // Make sure the executable is set. |