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 2022/09/25 18:11:32 UTC

[GitHub] [ozone] adoroszlai commented on a diff in pull request #3777: HDDS-7219. Ozone bucket list for links displays default layout for all linked buckets

adoroszlai commented on code in PR #3777:
URL: https://github.com/apache/ozone/pull/3777#discussion_r979439540


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/ListBucketHandler.java:
##########
@@ -51,7 +51,18 @@ protected void execute(OzoneClient client, OzoneAddress address)
     Iterator<? extends OzoneBucket> bucketIterator =
         vol.listBuckets(listOptions.getPrefix(), listOptions.getStartItem());
 
-    int counter = printAsJsonArray(bucketIterator, listOptions.getLimit());
+    int counter = 0;
+    printMsg("[");
+    while (bucketIterator.hasNext() && counter < listOptions.getLimit()) {
+      OzoneBucket entry = bucketIterator.next();
+      if (entry.getSourceBucket() != null && entry.getSourceVolume() != null) {
+        printObjectAsJson(new InfoBucketHandler.LinkBucket(entry));
+      } else {
+        printObjectAsJson(entry);
+      }
+      counter++;
+    }
+    printMsg("]");

Review Comment:
   I don't think this is outputs a valid json list, as items are not separated by comma (`,`).
   
   Instead of manually printing each item and trying to imitate a list, I think it would be better to replace link items with `LinkBucket` objects in-place, and let `printAsJsonArray` do the rest.



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