From 7b7aba0f7f373c40dfae34a21e3506dc7f5e18ae Mon Sep 17 00:00:00 2001 From: Juliano Martinez Date: Wed, 23 Sep 2020 10:45:16 +0200 Subject: [PATCH] remove nodeName call when using -service - fix #8734 --- command/maint/maint.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/command/maint/maint.go b/command/maint/maint.go index 46cf970e3..fa11ca63d 100644 --- a/command/maint/maint.go +++ b/command/maint/maint.go @@ -72,13 +72,14 @@ func (c *cmd) Run(args []string) int { return 1 } a := client.Agent() - nodeName, err := a.NodeName() - if err != nil { - c.UI.Error(fmt.Sprintf("Error querying Consul agent: %s", err)) - return 1 - } if !c.enable && !c.disable { + nodeName, err := a.NodeName() + if err != nil { + c.UI.Error(fmt.Sprintf("Error querying Consul agent: %s", err)) + return 1 + } + // List mode - list nodes/services in maintenance mode checks, err := a.Checks() if err != nil {