diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2019-08-13 13:06:37 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2019-08-21 17:28:30 +0200 |
commit | 56a65cffac2cee3132c950d49ea8a5b46eabbff1 (patch) | |
tree | c7353580fc33d03c05ade690717980c72630b691 /cmd/podman/generate_systemd.go | |
parent | a33e4a89ca4f689096f417ebddfe5b992470e54d (diff) | |
download | podman-56a65cffac2cee3132c950d49ea8a5b46eabbff1.tar.gz podman-56a65cffac2cee3132c950d49ea8a5b46eabbff1.tar.bz2 podman-56a65cffac2cee3132c950d49ea8a5b46eabbff1.zip |
generate systemd: support pods and geneartig files
Support generating systemd unit files for a pod. Podman generates one
unit file for the pod including the PID file for the infra container's
conmon process and one unit file for each container (excluding the infra
container).
Note that this change implies refactorings in the `pkg/systemdgen` API.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/generate_systemd.go')
-rw-r--r-- | cmd/podman/generate_systemd.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/cmd/podman/generate_systemd.go b/cmd/podman/generate_systemd.go index 222fc4c98..aa202a68d 100644 --- a/cmd/podman/generate_systemd.go +++ b/cmd/podman/generate_systemd.go @@ -5,7 +5,6 @@ import ( "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/pkg/adapter" - "github.com/containers/libpod/pkg/systemdgen" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -40,7 +39,10 @@ func init() { containerSystemdCommand.SetHelpTemplate(HelpTemplate()) containerSystemdCommand.SetUsageTemplate(UsageTemplate()) flags := containerSystemdCommand.Flags() - flags.BoolVarP(&containerSystemdCommand.Name, "name", "n", false, "use the container name instead of ID") + flags.BoolVarP(&containerSystemdCommand.Name, "name", "n", false, "use the container/pod name instead of ID") + if !remoteclient { + flags.BoolVarP(&containerSystemdCommand.Files, "files", "f", false, "generate files instead of printing to stdout") + } flags.IntVarP(&containerSystemdCommand.StopTimeout, "timeout", "t", -1, "stop timeout override") flags.StringVar(&containerSystemdCommand.RestartPolicy, "restart-policy", "on-failure", "applicable systemd restart-policy") } @@ -56,10 +58,6 @@ func generateSystemdCmd(c *cliconfig.GenerateSystemdValues) error { if c.Flag("timeout").Changed && c.StopTimeout < 0 { return errors.New("timeout value must be 0 or greater") } - // Make sure the input restart policy is valid - if err := systemdgen.ValidateRestartPolicy(c.RestartPolicy); err != nil { - return err - } unit, err := runtime.GenerateSystemd(c) if err != nil { |