From 9415670722373d1c374da3587ce953b3d99f8961 Mon Sep 17 00:00:00 2001 From: Sujil02 Date: Thu, 21 May 2020 03:50:33 -0400 Subject: Fixes podman pod create --pod-id-file #6292 Prints pod id to file and adds relevant test case Signed-off-by: Sujil02 --- cmd/podman/pods/create.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go index e24cdef98..88b615fab 100644 --- a/cmd/podman/pods/create.go +++ b/cmd/podman/pods/create.go @@ -3,6 +3,7 @@ package pods import ( "context" "fmt" + "io/ioutil" "os" "strings" @@ -147,6 +148,11 @@ func create(cmd *cobra.Command, args []string) error { if err != nil { return err } + if len(podIDFile) > 0 { + if err = ioutil.WriteFile(podIDFile, []byte(response.Id), 0644); err != nil { + return errors.Wrapf(err, "failed to write pod ID to file %q", podIDFile) + } + } fmt.Println(response.Id) return nil } -- cgit v1.2.3-54-g00ecf