diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-01-12 23:13:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-12 23:13:45 +0100 |
commit | 55dd73cf5830eb44128f5b580cee3fb1e74dbea6 (patch) | |
tree | 0e7ae475004271275149b2e8ea83c9226e148d18 /pkg/adapter | |
parent | 2d5fd7cc3718d27b35352e80c0c3296c5bb69c2f (diff) | |
parent | 816e50ba02837946afade83e3cad06dd44d213ec (diff) | |
download | podman-55dd73cf5830eb44128f5b580cee3fb1e74dbea6.tar.gz podman-55dd73cf5830eb44128f5b580cee3fb1e74dbea6.tar.bz2 podman-55dd73cf5830eb44128f5b580cee3fb1e74dbea6.zip |
Merge pull request #4823 from vrothberg/gen-systemd
podman-generate-systemd --new
Diffstat (limited to 'pkg/adapter')
-rw-r--r-- | pkg/adapter/containers.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index 3334e9fa1..fdd9f6ab3 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -1230,6 +1230,7 @@ func (r *LocalRuntime) generateSystemdgenContainerInfo(c *cliconfig.GenerateSyst PIDFile: conmonPidFile, StopTimeout: timeout, GenerateTimestamp: true, + CreateCommand: config.CreateCommand, } return info, true, nil @@ -1237,11 +1238,21 @@ func (r *LocalRuntime) generateSystemdgenContainerInfo(c *cliconfig.GenerateSyst // GenerateSystemd creates a unit file for a container or pod. func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (string, error) { + opts := systemdgen.Options{ + Files: c.Files, + New: c.New, + } + // First assume it's a container. if info, found, err := r.generateSystemdgenContainerInfo(c, c.InputArgs[0], nil); found && err != nil { return "", err } else if found && err == nil { - return systemdgen.CreateContainerSystemdUnit(info, c.Files) + return systemdgen.CreateContainerSystemdUnit(info, opts) + } + + // --new does not support pods. + if c.New { + return "", errors.Errorf("error generating systemd unit files: cannot generate generic files for a pod") } // We're either having a pod or garbage. @@ -1312,7 +1323,7 @@ func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (stri if i > 0 { builder.WriteByte('\n') } - out, err := systemdgen.CreateContainerSystemdUnit(info, c.Files) + out, err := systemdgen.CreateContainerSystemdUnit(info, opts) if err != nil { return "", err } |