summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-22 19:08:08 +0200
committerGitHub <noreply@github.com>2019-08-22 19:08:08 +0200
commitb263dd9e81bcadd3be5c7420fca9e53ecc8aef7c (patch)
treea88e48dfe6c6893d793c2f35318907fe9418b1c4 /cmd
parent34002f92ffa2c71c3f5190b6b73617f14652d674 (diff)
parent56a65cffac2cee3132c950d49ea8a5b46eabbff1 (diff)
downloadpodman-b263dd9e81bcadd3be5c7420fca9e53ecc8aef7c.tar.gz
podman-b263dd9e81bcadd3be5c7420fca9e53ecc8aef7c.tar.bz2
podman-b263dd9e81bcadd3be5c7420fca9e53ecc8aef7c.zip
Merge pull request #3800 from vrothberg/generate-pod
generate systemd pod
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/cliconfig/config.go1
-rw-r--r--cmd/podman/generate.go5
-rw-r--r--cmd/podman/generate_systemd.go10
-rw-r--r--cmd/podman/varlink/io.podman.varlink2
4 files changed, 9 insertions, 9 deletions
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index 8075baf34..9bc47333d 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -156,6 +156,7 @@ type GenerateKubeValues struct {
type GenerateSystemdValues struct {
PodmanCommand
Name bool
+ Files bool
RestartPolicy string
StopTimeout int
}
diff --git a/cmd/podman/generate.go b/cmd/podman/generate.go
index 98bfb00a1..196556bc5 100644
--- a/cmd/podman/generate.go
+++ b/cmd/podman/generate.go
@@ -18,11 +18,14 @@ var (
// Commands that are universally implemented
generateCommands = []*cobra.Command{
_containerKubeCommand,
- _containerSystemdCommand,
}
)
func init() {
+ // Systemd-service generation is not supported for remote-clients.
+ if !remoteclient {
+ generateCommands = append(generateCommands, _containerSystemdCommand)
+ }
generateCommand.Command = _generateCommand
generateCommand.AddCommand(generateCommands...)
generateCommand.SetUsageTemplate(UsageTemplate())
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 {
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index 1b10416a2..2873d9761 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -1241,8 +1241,6 @@ method GetLayersMapWithImageInfo() -> (layerMap: string)
# BuildImageHierarchyMap is for the development of Podman and should not be used.
method BuildImageHierarchyMap(name: string) -> (imageInfo: string)
-method GenerateSystemd(name: string, restart: string, timeout: int, useName: bool) -> (unit: string)
-
# ImageNotFound means the image could not be found by the provided name or ID in local storage.
error ImageNotFound (id: string, reason: string)