Skip to content

Commit

Permalink
Improve peer CLI error message when no orderer address passed (#1555)
Browse files Browse the repository at this point in the history
For peer CLI commands that require an orderer address, the peer
does best effort attempt to retrieve orderer address from channel
config if the orderer address is not passed (it currently only
checks the deprecated Orderer.Addresses, not the org level
OrdererEndpoints). The best effort attempt may be removed in
a future release, so for now improve the error message
to indicate that orderer address should be passed using
-o flag.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
(cherry picked from commit 6ef8f3d)
  • Loading branch information
denyeart authored and mergify-bot committed Jul 8, 2020
1 parent 9c3c599 commit 52ffee5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/peer/chaincode/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func InitCmdFactory(cmdName string, isEndorserRequired, isOrdererRequired bool,
return nil, errors.WithMessagef(err, "error getting channel (%s) orderer endpoint", channelID)
}
if len(orderingEndpoints) == 0 {
return nil, errors.Errorf("no orderer endpoints retrieved for channel %s", channelID)
return nil, errors.Errorf("no orderer endpoints retrieved for channel %s, pass orderer endpoint with -o flag instead", channelID)
}
logger.Infof("Retrieved channel (%s) orderer endpoint: %s", channelID, orderingEndpoints[0])
// override viper env
Expand Down
2 changes: 1 addition & 1 deletion internal/peer/lifecycle/chaincode/client_connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (c *ClientConnections) setOrdererClient() error {
return errors.WithMessagef(err, "error getting channel (%s) orderer endpoint", channelID)
}
if len(orderingEndpoints) == 0 {
return errors.Errorf("no orderer endpoints retrieved for channel %s", channelID)
return errors.Errorf("no orderer endpoints retrieved for channel %s, pass orderer endpoint with -o flag instead", channelID)
}

logger.Infof("Retrieved channel (%s) orderer endpoint: %s", channelID, orderingEndpoints[0])
Expand Down

0 comments on commit 52ffee5

Please sign in to comment.