summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-09-06 14:49:59 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-09-07 13:58:11 +0200
commitd1573b95e3427efae21da784e3112c5fb3d463fb (patch)
treeda311feeab3105d4577a7d5c4a9a1dc3027603aa /pkg/api
parente095667ac8c2ccaf06dea6d4c61f51d93b736968 (diff)
downloadpodman-d1573b95e3427efae21da784e3112c5fb3d463fb.tar.gz
podman-d1573b95e3427efae21da784e3112c5fb3d463fb.tar.bz2
podman-d1573b95e3427efae21da784e3112c5fb3d463fb.zip
generate systemd: handle --restart
Handle custom restart policies of containers when generating the unit files; those should be set on the unit level and removed from ExecStart flags. Fixes: #11438 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/generate.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/api/handlers/libpod/generate.go b/pkg/api/handlers/libpod/generate.go
index 0e6e9100a..8a2b93d0e 100644
--- a/pkg/api/handlers/libpod/generate.go
+++ b/pkg/api/handlers/libpod/generate.go
@@ -16,16 +16,15 @@ func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
decoder := r.Context().Value("decoder").(*schema.Decoder)
query := struct {
- Name bool `schema:"useName"`
- New bool `schema:"new"`
- NoHeader bool `schema:"noHeader"`
- RestartPolicy string `schema:"restartPolicy"`
- StopTimeout uint `schema:"stopTimeout"`
- ContainerPrefix string `schema:"containerPrefix"`
- PodPrefix string `schema:"podPrefix"`
- Separator string `schema:"separator"`
+ Name bool `schema:"useName"`
+ New bool `schema:"new"`
+ NoHeader bool `schema:"noHeader"`
+ RestartPolicy *string `schema:"restartPolicy"`
+ StopTimeout uint `schema:"stopTimeout"`
+ ContainerPrefix string `schema:"containerPrefix"`
+ PodPrefix string `schema:"podPrefix"`
+ Separator string `schema:"separator"`
}{
- RestartPolicy: "on-failure",
StopTimeout: util.DefaultContainerConfig().Engine.StopTimeout,
ContainerPrefix: "container",
PodPrefix: "pod",
@@ -49,6 +48,7 @@ func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
PodPrefix: query.PodPrefix,
Separator: query.Separator,
}
+
report, err := containerEngine.GenerateSystemd(r.Context(), utils.GetName(r), options)
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "error generating systemd units"))