From 4ae5e6123d3079256c5b8774aa096e9be6561faf Mon Sep 17 00:00:00 2001 From: decentral1se Date: Mon, 2 Aug 2021 01:06:41 +0200 Subject: [PATCH] refactor: add specific check for missing context --- cli/server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/server.go b/cli/server.go index e8d7f374a..245c16c75 100644 --- a/cli/server.go +++ b/cli/server.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net" + "strings" "coopcloud.tech/abra/client" "coopcloud.tech/abra/config" @@ -38,8 +39,8 @@ var serverListCommand = &cli.Command{ var row []string for _, ctx := range contexts { endpoint, err := client.GetContextEndpoint(ctx) - if err != nil { - // This most likely means its a non-docker swarm context and we can ignore + if err != nil && strings.Contains(err.Error(), "does not exist") { + // No local context found, we can continue safely continue } if ctx.Name == serverName {