tsuru/tsuru — pull request #1044 by msabramo (2014-12-31 22:20:57+00:00)
Title: `tsr api` fail with error if config file not found

`tsr help` and `tsr token` will not fail if a config file is not found, but `tsr api` will fail immediately with an error that if the config file is not found. The error message will tell the user where tsuru looked for the config file that was not found.

Before:

[marca@marca-mac2 tsuru]$ ~/go/bin/tsr api
Error: Config Error: you should have "listen" key set in your config file

After:

[marca@marca-mac2 tsuru]$ ~/go/bin/tsr api
Reading config file: /etc/tsuru/tsuru.conf
Failed to read config file: /etc/tsuru/tsuru.conf - open /etc/tsuru/tsuru.conf: no such file or directory

Note that this message tells the user the real problem - that the config file was not present, and it tells the user where it looked. Other commands are not affected:

[marca@marca-mac2 tsuru]$ ~/go/bin/tsr help
tsr version 0.9.1.

Usage: tsr command [args]

Available commands:
api
help
token
version

Use tsr help to get more information about a command.

[marca@marca-mac2 tsuru]$ ~/go/bin/tsr token
252eb6231376253f50c82074061ad169f463ffba