Browse Source

Log something to be able to see what is happening remotely

Signed-off-by: Guillaume Tardif <[email protected]>
Guillaume Tardif 5 years ago
parent
commit
b138a3e4f6
2 changed files with 7 additions and 3 deletions
  1. 3 0
      aci/etchosts/hosts.go
  2. 4 3
      aci/etchosts/main/main.go

+ 3 - 0
aci/etchosts/hosts.go

@@ -17,7 +17,9 @@
 package etchosts
 
 import (
+	"fmt"
 	"os"
+	"strings"
 )
 
 // SetHostNames appends hosts aliases for loopback address to etc/host file
@@ -28,6 +30,7 @@ func SetHostNames(file string, hosts ...string) error {
 	}
 	defer f.Close() //nolint:errcheck
 
+	fmt.Println("Setting local hosts for " + strings.Join(hosts, ", "))
 	for _, host := range hosts {
 		_, err = f.WriteString("\n127.0.0.1 " + host)
 	}

+ 4 - 3
aci/etchosts/main/main.go

@@ -18,10 +18,11 @@ package main
 
 import (
 	"fmt"
-	"github.com/docker/compose-cli/aci/etchosts"
 	"os"
 	"os/signal"
 	"syscall"
+
+	"github.com/docker/compose-cli/aci/etchosts"
 )
 
 const hosts = "/etc/hosts"
@@ -39,8 +40,8 @@ func main() {
 	}
 
 	// ACI restart policy is currently at container group level, cannot let the sidecar terminate quietly once /etc/hosts has been edited
-	// Pause forever (until someone explicitely terminates this process ; go is not happy to stop all goroutines otherwise)
-	exitSignal := make(chan os.Signal)
+	// Pause forever (until someone explicitly terminates this process ; go is not happy to stop all goroutines otherwise)
+	exitSignal := make(chan os.Signal, 1)
 	signal.Notify(exitSignal, syscall.SIGINT, syscall.SIGTERM)
 	<-exitSignal
 }