[ARVADOS] updated: 2.1.0-1051-g57f5d50c3

Git user git at public.arvados.org
Tue Jul 13 21:19:37 UTC 2021


Summary of changes:
 lib/service/cmd.go | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

       via  57f5d50c3315348e3b5be06b5f620532e850566b (commit)
      from  6d5d0c69464455b8be6dac693ebfd383fc1bcee3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 57f5d50c3315348e3b5be06b5f620532e850566b
Author: Tom Clegg <tom at curii.com>
Date:   Tue Jul 13 17:18:02 2021 -0400

    17667: Detect ambiguous uses of ListenAddress.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/service/cmd.go b/lib/service/cmd.go
index c85f034d9..9f6a60968 100644
--- a/lib/service/cmd.go
+++ b/lib/service/cmd.go
@@ -187,11 +187,34 @@ func getListenAddr(svcs arvados.Services, prog arvados.ServiceName, log logrus.F
 	}
 
 	if svc.ListenAddress != "" {
+		scheme := ""
 		for internalURL := range svc.InternalURLs {
-			listenURL := internalURL
-			listenURL.Host = svc.ListenAddress
-			return listenURL, internalURL, nil
+			if internalURL.Host == svc.ListenAddress {
+				if len(svc.InternalURLs) > 1 {
+					log.Warnf("possible configuration error: multiple InternalURLs entries exist for %s but only %q will ever be used because it matches ListenAddress", prog, internalURL.String())
+				}
+				return internalURL, internalURL, nil
+			}
+			switch scheme {
+			case "":
+				scheme = internalURL.Scheme
+			case internalURL.Scheme:
+			default:
+				scheme = "-" // different InternalURLs have different schemes
+			}
+		}
+		if scheme == "-" {
+			return arvados.URL{}, arvados.URL{}, fmt.Errorf("cannot use ListenAddress %q: InternalURLs use multiple schemes and none have host %q", svc.ListenAddress, svc.ListenAddress)
+		}
+		if scheme == "" {
+			// No entries at all in InternalURLs
+			scheme = "http"
 		}
+		listenURL := arvados.URL{}
+		listenURL.Host = svc.ListenAddress
+		listenURL.Scheme = scheme
+		listenURL.Path = "/"
+		return listenURL, listenURL, nil
 	}
 
 	errors := []string{}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list