You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jyotirmoy-gh (via GitHub)" <gi...@apache.org> on 2023/03/31 12:06:00 UTC

[GitHub] [ozone] jyotirmoy-gh commented on a diff in pull request #4508: HDDS-8185. ozone admin datanode list should have a json option for output

jyotirmoy-gh commented on code in PR #4508:
URL: https://github.com/apache/ozone/pull/4508#discussion_r1154394195


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java:
##########
@@ -88,7 +94,13 @@ public void execute(ScmClient scmClient) throws IOException {
       allNodes = allNodes.filter(p -> p.getHealthState().toString()
           .compareToIgnoreCase(nodeState) == 0);
     }
-    allNodes.forEach(this::printDatanodeInfo);
+
+    if (json) {
+      List<DatanodeWithAttributes> datanodeList = allNodes.collect(Collectors.toList());
+      System.out.print(JsonUtils.toJsonStringWithDefaultPrettyPrinter(datanodeList));

Review Comment:
   Reduced the line length



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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

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