From 325f8a84f80f79f5d85ba8d410fea780f1c94e0e Mon Sep 17 00:00:00 2001 From: Alisdair McDiarmid Date: Thu, 6 Feb 2020 14:59:26 -0500 Subject: [PATCH] command/logout: Exit early if already logged out --- command/logout.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command/logout.go b/command/logout.go index b3325b24d..489877a8b 100644 --- a/command/logout.go +++ b/command/logout.go @@ -95,9 +95,12 @@ func (c *LogoutCommand) Run(args []string) int { // in a test, but it should always be set in normal use. if credsCtx != nil { switch credsCtx.Location { + case cliconfig.CredentialsNotAvailable: + c.Ui.Output(fmt.Sprintf("No credentials for %s are stored.\n", dispHostname)) + return 0 case cliconfig.CredentialsViaHelper: c.Ui.Output(fmt.Sprintf("Removing the stored credentials for %s from the configured\n%q credentials helper.\n", dispHostname, credsCtx.HelperType)) - case cliconfig.CredentialsInPrimaryFile, cliconfig.CredentialsNotAvailable: + case cliconfig.CredentialsInPrimaryFile: c.Ui.Output(fmt.Sprintf("Removing the stored credentials for %s from the following file:\n %s\n", dispHostname, credsCtx.LocalFilename)) } }