mirror of
https://github.com/docker/compose.git
synced 2025-07-23 13:45:00 +02:00
Log something to be able to see what is happening remotely
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
18e43b277c
commit
b138a3e4f6
@ -17,7 +17,9 @@
|
|||||||
package etchosts
|
package etchosts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetHostNames appends hosts aliases for loopback address to etc/host file
|
// 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
|
defer f.Close() //nolint:errcheck
|
||||||
|
|
||||||
|
fmt.Println("Setting local hosts for " + strings.Join(hosts, ", "))
|
||||||
for _, host := range hosts {
|
for _, host := range hosts {
|
||||||
_, err = f.WriteString("\n127.0.0.1 " + host)
|
_, err = f.WriteString("\n127.0.0.1 " + host)
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/docker/compose-cli/aci/etchosts"
|
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/aci/etchosts"
|
||||||
)
|
)
|
||||||
|
|
||||||
const hosts = "/etc/hosts"
|
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
|
// 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)
|
// Pause forever (until someone explicitly terminates this process ; go is not happy to stop all goroutines otherwise)
|
||||||
exitSignal := make(chan os.Signal)
|
exitSignal := make(chan os.Signal, 1)
|
||||||
signal.Notify(exitSignal, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(exitSignal, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-exitSignal
|
<-exitSignal
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user