mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +08:00
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:
@ -1,5 +1,3 @@
|
||||
// +build !remote
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
@ -61,7 +59,7 @@ var _ = Describe("Podman generate systemd", func() {
|
||||
session = podmanTest.Podman([]string{"generate", "systemd", "--restart-policy", "bogus", "foobar"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).To(ExitWithError())
|
||||
found, _ := session.ErrorGrepString("Error: bogus is not a valid restart policy")
|
||||
found, _ := session.ErrorGrepString("bogus is not a valid restart policy")
|
||||
Expect(found).Should(BeTrue())
|
||||
})
|
||||
|
||||
@ -383,4 +381,15 @@ var _ = Describe("Podman generate systemd", func() {
|
||||
found, _ = session.GrepString("pod rm --ignore -f --pod-id-file %t/pod-foo.pod-id")
|
||||
Expect(found).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman generate systemd --format json", func() {
|
||||
n := podmanTest.Podman([]string{"create", "--name", "foo", ALPINE})
|
||||
n.WaitWithDefaultTimeout()
|
||||
Expect(n.ExitCode()).To(Equal(0))
|
||||
|
||||
session := podmanTest.Podman([]string{"generate", "systemd", "--format", "json", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user