Skip to content

Commit

Permalink
Add error message for CA generation (sql-machine-learning#817)
Browse files Browse the repository at this point in the history
* [Do not merge] Debug CI

* fix build
  • Loading branch information
tonyyang-svail committed Sep 16, 2019
1 parent 88af2fe commit db95106
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmd/sqlflowserver/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,17 @@ func generateTempCA() (tmpDir, caCrt, caKey string, err error) {
caKey = path.Join(tmpDir, "ca.key")
caCsr := path.Join(tmpDir, "ca.csr")
caCrt = path.Join(tmpDir, "ca.crt")
if err = exec.Command("openssl", "genrsa", "-out", caKey, "2048").Run(); err != nil {
return
if output, err := exec.Command("openssl", "genrsa", "-out", caKey, "2048").CombinedOutput(); err != nil {
err = fmt.Errorf("\n%s\n%s", output, err.Error())
return "", "", "", err
}
if err = exec.Command("openssl", "req", "-nodes", "-new", "-key", caKey, "-subj", "/CN=localhost", "-out", caCsr).Run(); err != nil {
return
if output, err := exec.Command("openssl", "req", "-nodes", "-new", "-key", caKey, "-subj", "/CN=localhost", "-out", caCsr).CombinedOutput(); err != nil {
err = fmt.Errorf("\n%s\n%s", output, err.Error())
return "", "", "", err
}
if err = exec.Command("openssl", "x509", "-req", "-sha256", "-days", "365", "-in", caCsr, "-signkey", caKey, "-out", caCrt).Run(); err != nil {
return
if output, err := exec.Command("openssl", "x509", "-req", "-sha256", "-days", "365", "-in", caCsr, "-signkey", caKey, "-out", caCrt).CombinedOutput(); err != nil {
err = fmt.Errorf("\n%s\n%s", output, err.Error())
return "", "", "", err
}
os.Setenv("SQLFLOW_CA_CRT", caCrt)
os.Setenv("SQLFLOW_CA_KEY", caKey)
Expand Down

0 comments on commit db95106

Please sign in to comment.