generate systemd: clarify limitations of --new

`generate systemd --new` is looking at the "create command" of the
container/pod which is simply the os.Args at creation time.

It does not work on containers or pods created via the REST API since
the create command is not set.  `--new` does work on such containers and
pods since there is no reliable way to reverse-map their configs to
command-line arguments of podman.

Fixes: #11370
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2021-08-31 14:51:39 +02:00
parent bebaef26fd
commit f9a689f3ed
3 changed files with 4 additions and 2 deletions

View File

@ -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)