smengcl commented on code in PR #3381:
URL: https://github.com/apache/ozone/pull/3381#discussion_r877577463


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantDeleteHandler.java:
##########
@@ -35,30 +38,36 @@ public class TenantDeleteHandler extends TenantHandler {
   @CommandLine.Parameters(description = "Tenant name", arity = "1..1")
   private String tenantId;
 
-  // TODO: HDDS-6340. Add an option to print JSON result
-
   @Override
   protected void execute(OzoneClient client, OzoneAddress address)
       throws IOException {
-    try {
-      final DeleteTenantState resp =
-          client.getObjectStore().deleteTenant(tenantId);
-      out().println("Deleted tenant '" + tenantId + "'.");
-      long volumeRefCount = resp.getVolRefCount();
-      assert (volumeRefCount >= 0L);
-      final String volumeName = resp.getVolumeName();
-      final String extraPrompt =
-          "But the associated volume '" + volumeName + "' is not removed. ";
-      if (volumeRefCount == 0L) {
-        out().println(extraPrompt + "To delete it, run"
-            + "\n    ozone sh volume delete " + volumeName + "\n");
-      } else {
-        out().println(extraPrompt + "And it is still referenced by some other "
-            + "Ozone features (refCount is " + volumeRefCount + ").");
-      }
-    } catch (IOException e) {
-      // Throw exception to make client exit code non-zero
-      throw new IOException("Failed to delete tenant '" + tenantId + "'", e);
+
+    final DeleteTenantState resp =
+        client.getObjectStore().deleteTenant(tenantId);
+
+    err().println("Deleted tenant '" + tenantId + "'.");

Review Comment:
   Yeah this was debated earlier with @errose28 last week.
   
   The point is to have a nice prompt that informs the admin to delete the 
volume manually.
   
   stderr doesn't necessarily have to only contain error message though (e.g. 
try `wget google.com 2> /dev/null`). The point here is to seperate the JSON 
output (printed to stdout) and user prompts.



-- 
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: [email protected]

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