Skip to content

Commit

Permalink
Minor usability issue with tctl
Browse files Browse the repository at this point in the history
tctl was doing configuration validation too early, even on "version"
command (which should always succeed)
  • Loading branch information
kontsevoy committed Oct 10, 2016
1 parent f97ad75 commit 07e8d21
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tool/tctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ func main() {
utils.FatalError(err)
}

// "version" command?
if command == ver.FullCommand() {
onVersion()
return
}

applyConfig(&ccf, cfg)
validateConfig(cfg)

Expand All @@ -218,7 +224,6 @@ func main() {
}
return
}

// connect to the teleport auth service:
client, err := connectToAuthService(cfg)
if err != nil {
Expand All @@ -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():
Expand Down Expand Up @@ -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))
}
}

Expand Down

0 comments on commit 07e8d21

Please sign in to comment.