You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/03/24 21:55:14 UTC
[GitHub] [ozone] fapifta commented on a change in pull request #2057: HDDS-4989. Decommission CLI should return details of nodes which fail
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org