From 07e8d212ff5caff194feb4b217b4638e238d0c86 Mon Sep 17 00:00:00 2001 From: Ev Kontsevoy Date: Mon, 10 Oct 2016 16:39:06 -0700 Subject: [PATCH] Minor usability issue with tctl tctl was doing configuration validation too early, even on "version" command (which should always succeed) --- tool/tctl/main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tool/tctl/main.go b/tool/tctl/main.go index d3494d2a2cdd3..92693504e7654 100644 --- a/tool/tctl/main.go +++ b/tool/tctl/main.go @@ -200,6 +200,12 @@ func main() { utils.FatalError(err) } + // "version" command? + if command == ver.FullCommand() { + onVersion() + return + } + applyConfig(&ccf, cfg) validateConfig(cfg) @@ -218,7 +224,6 @@ func main() { } return } - // connect to the teleport auth service: client, err := connectToAuthService(cfg) if err != nil { @@ -227,8 +232,6 @@ func main() { // execute the selected command: switch command { - case ver.FullCommand(): - onVersion() case userAdd.FullCommand(): err = cmdUsers.Add(client) case userList.FullCommand(): @@ -722,7 +725,7 @@ func validateConfig(cfg *service.Config) { // read a host UUID for this node cfg.HostUUID, err = utils.ReadHostUUID(cfg.DataDir) if err != nil { - utils.FatalError(err) + utils.FatalError(fmt.Errorf("Invalid data directory: '%s'", cfg.DataDir)) } }