APIv2 add generate systemd endpoint

Add support for generating systemd units
via the api and podman-remote.

Change the GenerateSystemdReport type to return the
units as map[string]string with the unit name as key.

Add `--format` flag to `podman generate systemd`
to allow the output to be formatted as json.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
Paul Holzinger
2020-08-05 09:29:59 +02:00
parent 1184cdf03d
commit ebfea2f4f8
13 changed files with 275 additions and 84 deletions

View File

@ -58,7 +58,8 @@ KillMode=none
Type=forking
[Install]
WantedBy=multi-user.target default.target`
WantedBy=multi-user.target default.target
`
podGoodNamedNew := `# pod-123abc.service
# autogenerated by Podman CI
@ -84,7 +85,8 @@ KillMode=none
Type=forking
[Install]
WantedBy=multi-user.target default.target`
WantedBy=multi-user.target default.target
`
tests := []struct {
name string
@ -130,8 +132,7 @@ WantedBy=multi-user.target default.target`
test := tt
t.Run(tt.name, func(t *testing.T) {
opts := entities.GenerateSystemdOptions{
Files: false,
New: test.new,
New: test.new,
}
got, err := executePodTemplate(&test.info, opts)
if (err != nil) != test.wantErr {