From ebfcc7231155b3d16e30dfcb91a221511edb7f40 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Thu, 2 Dec 2021 12:36:15 +0100 Subject: [PATCH] Fix a problem on wait port number --- generator/main.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/generator/main.go b/generator/main.go index 4760e7b..7f1bcec 100644 --- a/generator/main.go +++ b/generator/main.go @@ -162,7 +162,7 @@ func parseService(name string, s compose.Service, ret chan interface{}) { if strings.HasPrefix(volname, ".") || strings.HasPrefix(volname, "/") { // local volume cannt be mounted // 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 //os.Exit(1) } @@ -213,19 +213,19 @@ func parseService(name string, s compose.Service, ret chan interface{}) { foundPort := -1 if defaultPort, err := getPort(dp); err != nil { // BUG: Sometimes the chan remains opened - foundPort := <-waitPort(dp) - if foundPort == -1 { - log.Fatalf( - "ERROR, the %s service is waiting for %s port number, "+ - "but it is never discovered. You must declare at least one port in "+ - "the \"ports\" section of the service in the docker-compose file", - name, - dp, - ) - } + foundPort = <-waitPort(dp) } else { foundPort = defaultPort } + if foundPort == -1 { + log.Fatalf( + "ERROR, the %s service is waiting for %s port number, "+ + "but it is never discovered. You must declare at least one port in "+ + "the \"ports\" section of the service in the docker-compose file", + name, + dp, + ) + } command = strings.ReplaceAll(command, "__port__", strconv.Itoa(foundPort)) c.Command = []string{