Skip to content

Commit e329b15

Browse files
authored
Merge pull request #21 from UKHomeOffice/fixstderr
Print kubectl errors
2 parents a3edbce + 9c1a3c0 commit e329b15

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

main.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"bytes"
45
"fmt"
56
"io/ioutil"
67
"log"
@@ -145,16 +146,21 @@ func deploy(c *cli.Context, r *ObjectResource) error {
145146
return err
146147
}
147148

149+
var outbuf, errbuf bytes.Buffer
150+
cmd.Stdout = &outbuf
151+
cmd.Stderr = &errbuf
152+
148153
stdin.Write(r.Template)
149154
stdin.Close()
150155
if err != nil {
151156
return err
152157
}
153158
logInfo.Printf("deploying %s/%s", strings.ToLower(r.Kind), r.Name)
154159
if err = cmd.Run(); err != nil {
160+
logError.Print(errbuf.String())
155161
return err
156162
}
157-
logInfo.Printf("%s %q submitted", strings.ToLower(r.Kind), r.Name)
163+
logInfo.Print(outbuf.String())
158164
if r.Kind != "Deployment" {
159165
return nil
160166
}

0 commit comments

Comments
 (0)