From 9287272dff87cb8c35eafeff9dcc91190d0b5ba6 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Thu, 26 Aug 2021 18:29:28 +0200 Subject: [PATCH] locksmithcl: reset endpoints when we set a new one This behavior was working fine previously but no more with the etcd/v2 upgrade. In the case we have an endpoint like `https://127.0.0.1:2379`, this one will be _added_ to the list of `defaultEndpoints` which lead to this endpoints: ```go []string{ "http://127.0.0.1:2379", "http://127.0.0.1:4001", "https://127.0.0.1:2379", } ``` It's not an issue when we have a retry mechanism - but in this case if `etcd` use HTTPS and we try an `HTTP` endpoint, we will get an io.EOF error. Signed-off-by: Mathieu Tortuyaux --- locksmithctl/locksmithctl.go | 1 + 1 file changed, 1 insertion(+) diff --git a/locksmithctl/locksmithctl.go b/locksmithctl/locksmithctl.go index 3eaa6ed..a8b93a3 100644 --- a/locksmithctl/locksmithctl.go +++ b/locksmithctl/locksmithctl.go @@ -76,6 +76,7 @@ func (e *endpoints) String() string { } func (e *endpoints) Set(value string) error { + *e = []string{} for _, url := range strings.Split(value, ",") { *e = append(*e, strings.TrimSpace(url)) }