sodonnel commented on a change in pull request #2057:
URL: https://github.com/apache/ozone/pull/2057#discussion_r600939397



##########
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:
       Yes I agree. I had the same thought and realised that the way we have 
the GenericCLI setup, it prevents us returning a specific non-zero code. For 
this soft-failure (some worked some failed), I would like to have returned a 
specific code.
   
   However, I did not want to get into refactoring Generic CLI as part of this 
change. The other problem, is that we are somewhat short of unit tests for the 
CLI commands, so any change we make to that area will need new tests added and 
some manual validation.
   
   I will raise a Jira with the suggestion tomorrow before committing this. 
Thanks for the review!




-- 
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]

Reply via email to