Skip to content

Commit

Permalink
Just use the presence of the environment variable DOCKER_MACHINE_NAME…
Browse files Browse the repository at this point in the history
… on Windows to determine if the path should be changed

Updated to terragrunt v0.12.18.02 (Coveo edition)
  • Loading branch information
jocgir committed May 25, 2017
1 parent 2ed0edd commit 4bba960
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:latest

ARG TERRAFORM_VERSION=0.9.5
ARG TERRAGRUNT_VERSION=0.12.18.01
ARG TERRAGRUNT_VERSION=0.12.18.02
ARG GOTEMPLATE_VERSION=1.0

LABEL vendor="Coveo"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.Full
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:latest

ARG TERRAFORM_VERSION=0.9.5
ARG TERRAGRUNT_VERSION=0.12.18.01
ARG TERRAGRUNT_VERSION=0.12.18.02
ARG GOTEMPLATE_VERSION=1.0

ARG DEBIAN_FRONTEND=noninteractive
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.Shell
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:latest

ARG TERRAFORM_VERSION=0.9.5
ARG TERRAGRUNT_VERSION=0.12.18.01
ARG TERRAGRUNT_VERSION=0.12.18.02
ARG GOTEMPLATE_VERSION=1.0

LABEL vendor="Coveo"
Expand Down
14 changes: 3 additions & 11 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,10 @@ func getEnviron() (result []string) {

// This function set the path converter function
// For old Windows version still using docker-machine and VirtualBox,
// it transforms the C:\ to \C\.
// it transforms the C:\ to /C/.
func getPathConversionFunction() func(string) string {
noConversion := func(path string) string { return path }
if runtime.GOOS != "windows" {
return noConversion
}

var out bytes.Buffer
dockerCmd := exec.Command("docker-machine", "env")
dockerCmd.Stdout, dockerCmd.Stderr = &out, &out
if dockerCmd.Run() != nil {
return noConversion
if runtime.GOOS != "windows" || os.Getenv("DOCKER_MACHINE_NAME") == "" {
return func(path string) string { return path }
}

return func(path string) string {
Expand Down

0 comments on commit 4bba960

Please sign in to comment.