Fix a problem on wait port number

This commit is contained in:
2021-12-02 12:36:15 +01:00
parent bced2a1be6
commit ebfcc72311

View File

@@ -162,7 +162,7 @@ func parseService(name string, s compose.Service, ret chan interface{}) {
if strings.HasPrefix(volname, ".") || strings.HasPrefix(volname, "/") { if strings.HasPrefix(volname, ".") || strings.HasPrefix(volname, "/") {
// local volume cannt be mounted // local volume cannt be mounted
// TODO: propose a way to make configMap for some files or directory // TODO: propose a way to make configMap for some files or directory
Redf("You cannot, at this time, have local volume in %s service", name) Redf("You cannot, at this time, have local volume in %s deployment\n", name)
continue continue
//os.Exit(1) //os.Exit(1)
} }
@@ -213,7 +213,10 @@ func parseService(name string, s compose.Service, ret chan interface{}) {
foundPort := -1 foundPort := -1
if defaultPort, err := getPort(dp); err != nil { if defaultPort, err := getPort(dp); err != nil {
// BUG: Sometimes the chan remains opened // BUG: Sometimes the chan remains opened
foundPort := <-waitPort(dp) foundPort = <-waitPort(dp)
} else {
foundPort = defaultPort
}
if foundPort == -1 { if foundPort == -1 {
log.Fatalf( log.Fatalf(
"ERROR, the %s service is waiting for %s port number, "+ "ERROR, the %s service is waiting for %s port number, "+
@@ -223,9 +226,6 @@ func parseService(name string, s compose.Service, ret chan interface{}) {
dp, dp,
) )
} }
} else {
foundPort = defaultPort
}
command = strings.ReplaceAll(command, "__port__", strconv.Itoa(foundPort)) command = strings.ReplaceAll(command, "__port__", strconv.Itoa(foundPort))
c.Command = []string{ c.Command = []string{