diff options
Diffstat (limited to 'pkg/systemd/generate/containers.go')
-rw-r--r-- | pkg/systemd/generate/containers.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go index abe159812..92c6d8865 100644 --- a/pkg/systemd/generate/containers.go +++ b/pkg/systemd/generate/containers.go @@ -9,9 +9,9 @@ import ( "text/template" "time" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/version" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/version" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/pflag" @@ -65,10 +65,11 @@ type containerInfo struct { ExecStop string // ExecStopPost of the unit. ExecStopPost string - + // Removes autogenerated by Podman and timestamp if set to true + GenerateNoHeader bool // If not nil, the container is part of the pod. We can use the // podInfo to extract the relevant data. - pod *podInfo + Pod *podInfo } const containerTemplate = headerTemplate + ` @@ -215,8 +216,8 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst ) // If the container is in a pod, make sure that the // --pod-id-file is set correctly. - if info.pod != nil { - podFlags := []string{"--pod-id-file", info.pod.PodIDFile} + if info.Pod != nil { + podFlags := []string{"--pod-id-file", "{{{{.Pod.PodIDFile}}}}"} startCommand = append(startCommand, podFlags...) info.CreateCommand = filterPodFlags(info.CreateCommand) } @@ -292,10 +293,15 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst if info.PodmanVersion == "" { info.PodmanVersion = version.Version.String() } + + if options.NoHeader { + info.GenerateNoHeader = true + info.GenerateTimestamp = false + } + if info.GenerateTimestamp { info.TimeStamp = fmt.Sprintf("%v", time.Now().Format(time.UnixDate)) } - // Sort the slices to assure a deterministic output. sort.Strings(info.BoundToServices) |