summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorSujil02 <sushah@redhat.com>2020-05-21 03:50:33 -0400
committerSujil02 <sushah@redhat.com>2020-05-21 11:56:17 -0400
commit9415670722373d1c374da3587ce953b3d99f8961 (patch)
tree81de0c544fcd77be0c00586e1f1c511623f31c1d /cmd
parent09f8f14b4f7d09946d3d5cfc5460ec9923f7da59 (diff)
downloadpodman-9415670722373d1c374da3587ce953b3d99f8961.tar.gz
podman-9415670722373d1c374da3587ce953b3d99f8961.tar.bz2
podman-9415670722373d1c374da3587ce953b3d99f8961.zip
Fixes podman pod create --pod-id-file #6292
Prints pod id to file and adds relevant test case Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/pods/create.go6
1 files changed, 6 insertions, 0 deletions
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
}