Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Commit

Permalink
Uncomment temporarily disabled code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsomesan committed Sep 5, 2017
1 parent a89dae6 commit b2ed4c3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions installer/api/handlers_terraform.go
Expand Up @@ -5,8 +5,10 @@ import (
"fmt"
"net/http"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
"time"

"github.com/dghubble/sessions"
Expand Down Expand Up @@ -60,16 +62,16 @@ func terraformApplyHandler(w http.ResponseWriter, req *http.Request, ctx *Contex
return newInternalServerError("could not write Terraform templates: %s", err)
}

// // Choose to run 'get' or 'init' based on Terraform version.
// sub10Rx := regexp.MustCompile("^Terraform v0\\.[0-9]\\.[0-9]+")
// out, err := exec.Command("terraform", "version").Output()
// if err != nil {
// return newInternalServerError("Failed to determine Terraform version: %s", err)
// }
// Choose to run 'get' or 'init' based on Terraform version.
sub10Rx := regexp.MustCompile("^Terraform v0\\.[0-9]\\.[0-9]+")
out, err := exec.Command("terraform", "version").Output()
if err != nil {
return newInternalServerError("Failed to determine Terraform version: %s", err)
}
prepCommand := "init"
// if sub10Rx.Match(out) {
// prepCommand = "get"
// }
if sub10Rx.Match(out) {
prepCommand = "get"
}

// Execute Terraform get or init and wait for it to finish.
_, prepDone, err := ex.Execute(prepCommand, "-no-color", tfMainDir)
Expand Down

0 comments on commit b2ed4c3

Please sign in to comment.