From 41f8f0113b1906846ec8bf436ed81dd818ff3055 Mon Sep 17 00:00:00 2001 From: WTFKr0 Date: Tue, 24 Jan 2017 11:29:45 +0100 Subject: [PATCH 1/3] Replace underscores to dash in autogenerated urls (docker provider) Signed-off-by: WTFKr0 --- provider/docker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provider/docker.go b/provider/docker.go index 2ffeb41ac..1871d1c1f 100644 --- a/provider/docker.go +++ b/provider/docker.go @@ -595,9 +595,9 @@ func parseContainer(container dockertypes.ContainerJSON) dockerData { return dockerData } -// Escape beginning slash "/", convert all others to dash "-" +// Escape beginning slash "/", convert all others to dash "-", and convert underscores "_" to dash "-" func (provider *Docker) getSubDomain(name string) string { - return strings.Replace(strings.TrimPrefix(name, "/"), "/", "-", -1) + return strings.Replace(strings.Replace(strings.TrimPrefix(name, "/"), "/", "-", -1), "_", "-", -1) } func (provider *Docker) listServices(ctx context.Context, dockerClient client.APIClient) ([]dockerData, error) { From b1764a68649ac501a27f791f58186c21b479ced7 Mon Sep 17 00:00:00 2001 From: WTFKr0 Date: Mon, 6 Feb 2017 14:01:08 +0100 Subject: [PATCH 2/3] Adapt test to new urls Signed-off-by: WTFKr0 --- integration/docker_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/docker_test.go b/integration/docker_test.go index f503634c7..9fc2fa5a7 100644 --- a/integration/docker_test.go +++ b/integration/docker_test.go @@ -110,7 +110,7 @@ func (s *DockerSuite) TestDefaultDockerContainers(c *check.C) { client := &http.Client{} req, err := http.NewRequest("GET", "http://127.0.0.1:8000/version", nil) c.Assert(err, checker.IsNil) - req.Host = fmt.Sprintf("%s.docker.localhost", name) + req.Host = fmt.Sprintf("%s.docker.localhost", strings.Replace(name, "_", "-", -1)) resp, err := client.Do(req) c.Assert(err, checker.IsNil) From 250a0863f6ed05ea40c8ae11819523dbf0d0f4ff Mon Sep 17 00:00:00 2001 From: WTFKr0 Date: Mon, 6 Feb 2017 14:18:12 +0100 Subject: [PATCH 3/3] Tab Lint Signed-off-by: WTFKr0 --- integration/docker_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/docker_test.go b/integration/docker_test.go index 9fc2fa5a7..4aa6f0b7b 100644 --- a/integration/docker_test.go +++ b/integration/docker_test.go @@ -110,7 +110,7 @@ func (s *DockerSuite) TestDefaultDockerContainers(c *check.C) { client := &http.Client{} req, err := http.NewRequest("GET", "http://127.0.0.1:8000/version", nil) c.Assert(err, checker.IsNil) - req.Host = fmt.Sprintf("%s.docker.localhost", strings.Replace(name, "_", "-", -1)) + req.Host = fmt.Sprintf("%s.docker.localhost", strings.Replace(name, "_", "-", -1)) resp, err := client.Do(req) c.Assert(err, checker.IsNil)