fapifta commented on a change in pull request #2057:
URL: https://github.com/apache/ozone/pull/2057#discussion_r600900043
##########
File path:
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/MaintenanceSubCommand.java
##########
@@ -51,9 +52,20 @@
@Override
public void execute(ScmClient scmClient) throws IOException {
if (hosts.size() > 0) {
- scmClient.startMaintenanceNodes(hosts, endInHours);
+ List<DatanodeAdminError> errors =
+ scmClient.startMaintenanceNodes(hosts, endInHours);
System.out.println("Entering maintenance mode on datanode(s):\n" +
String.join("\n", hosts));
+ if (errors.size() > 0) {
+ for (DatanodeAdminError error : errors) {
+ System.err.println("Error: " + error.getHostname() +": "
+ + error.getError());
+ }
+ // Throwing the exception will cause a non-zero exit status for the
+ // command.
+ throw new IOException(
Review comment:
I am not sure if this is the best way, but at the moment as I understood
GenericCLI we might not have any other way. We may file a follow up JIRA to
utilize picocli facilities for returning an exit code instead of throwing an
exception here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]