Skip to content

Commit

Permalink
Merge pull request #11371 from vrothberg/fix-11370
Browse files Browse the repository at this point in the history
[CI:DOCS] generate systemd: clarify limitations of `--new`
  • Loading branch information
openshift-merge-robot authored Sep 1, 2021
2 parents bebaef2 + f9a689f commit 331b359
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/podman/generate/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func init() {
timeFlagName := "time"
flags.UintVarP(&systemdTimeout, timeFlagName, "t", containerConfig.Engine.StopTimeout, "Stop timeout override")
_ = systemdCmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone)
flags.BoolVarP(&systemdOptions.New, "new", "", false, "Create a new container instead of starting an existing one")
flags.BoolVarP(&systemdOptions.New, "new", "", false, "Create a new container or pod instead of starting an existing one")
flags.BoolVarP(&systemdOptions.NoHeader, "no-header", "", false, "Skip header generation")

containerPrefixFlagName := "container-prefix"
Expand Down
2 changes: 2 additions & 0 deletions docs/source/markdown/podman-generate-systemd.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Use the name of the container for the start, stop, and description in the unit f

Using this flag will yield unit files that do not expect containers and pods to exist. Instead, new containers and pods are created based on their configuration files. The unit files are created best effort and may need to be further edited; please review the generated files carefully before using them in production.

Note that `--new` only works on containers and pods created directly via Podman (i.e., `podman [container] {create,run}` or `podman pod create`). It does not work on containers or pods created via the REST API or via `podman play kube`.

#### **--no-header**

Do not generate the header including meta data such as the Podman version and the timestamp.
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/generate/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste
if config.CreateCommand != nil {
createCommand = config.CreateCommand
} else if options.New {
return nil, errors.Errorf("cannot use --new on container %q: no create command found", ctr.ID())
return nil, errors.Errorf("cannot use --new on container %q: no create command found: only works on containers created directly with podman but not via REST API", ctr.ID())
}

nameOrID, serviceName := containerServiceName(ctr, options)
Expand Down

0 comments on commit 331b359

Please sign in to comment.