cosmos-sdk/cosmovisor/errors
Robert Zaremba f6458f0795
fix(cosmovisor): udpate the help and version command output (#10458)
## Description

Closes: #10450

* `cosmovisor help` should not print any error. 
* `cosmovisor version` should print more clear message if it can't run `app version`.

## Before 

```
~/tmp ❯ cosmovisor version
Cosmosvisor - A process manager for Cosmos SDK application binaries.

Cosmovisor is a wrapper for a Cosmos SDK based App (set using the required DAEMON_NAME env variable).
It starts the App by passing all provided arguments and monitors the DAEMON_HOME/data/upgrade-info.json
file to perform an update. The upgrade-info.json file is created by the App x/upgrade module
when the blockchain height reaches an approved upgrade proposal. The file includes data from
the proposal. Cosmovisor interprets that data to perform an update: switch a current binary
and restart the App.

Configuration of Cosmovisor is done through environment variables, which are
documented in: https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor/README.md

8:03PM ERR multiple configuration errors found: module=cosmovisor
8:03PM ERR   1: error="DAEMON_NAME is not set" module=cosmovisor
8:03PM ERR   2: error="DAEMON_HOME is not set" module=cosmovisor
8:03PM ERR  error="2 errors: 1: DAEMON_NAME is not set, 2: DAEMON_HOME is not set" module=cosmovisor


❯ cosmovisor help
Cosmosvisor - A process manager for Cosmos SDK application binaries.

Cosmovisor is a wrapper for a Cosmos SDK based App (set using the required DAEMON_NAME env variable).
It starts the App by passing all provided arguments and monitors the DAEMON_HOME/data/upgrade-info.json
file to perform an update. The upgrade-info.json file is created by the App x/upgrade module
when the blockchain height reaches an approved upgrade proposal. The file includes data from
the proposal. Cosmovisor interprets that data to perform an update: switch a current binary
and restart the App.

Configuration of Cosmovisor is done through environment variables, which are
documented in: https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor/README.md

8:03PM ERR multiple configuration errors found: module=cosmovisor
8:03PM ERR   1: error="DAEMON_NAME is not set" module=cosmovisor
8:03PM ERR   2: error="DAEMON_HOME is not set" module=cosmovisor
8:03PM ERR  error="2 errors: 1: DAEMON_NAME is not set, 2: DAEMON_HOME is not set" module=cosmovisor
```

## After

```
❯ ./cosmovisor version
Cosmovisor Version:  v1.0.0-76-g66bddfb04
8:05PM ERR Can't run APP version
8:05PM ERR   1: error="DAEMON_NAME is not set"
8:05PM ERR   2: error="DAEMON_HOME is not set"


❯ ./cosmovisor help
Cosmosvisor - A process manager for Cosmos SDK application binaries.

Cosmovisor is a wrapper for a Cosmos SDK based App (set using the required DAEMON_NAME env variable).
It starts the App by passing all provided arguments and monitors the DAEMON_HOME/data/upgrade-info.json
file to perform an update. The upgrade-info.json file is created by the App x/upgrade module
when the blockchain height reaches an approved upgrade proposal. The file includes data from
the proposal. Cosmovisor interprets that data to perform an update: switch a current binary
and restart the App.

Configuration of Cosmovisor is done through environment variables, which are
documented in: https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor/README.md

To get help for the configured binary:
  cosmovisor run help
```




---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
2021-11-19 17:35:56 +00:00
..
multi.go fix(cosmovisor): udpate the help and version command output (#10458) 2021-11-19 17:35:56 +00:00
multi_test.go feat: Add cosmovisor --help (#10229) 2021-09-29 01:08:31 +02:00