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/05/19 14:07:52 UTC

[GitHub] [ozone] smengcl commented on a diff in pull request #3381: HDDS-6340. [Multi-Tenant] Add tenant CLI option to print results in JSON

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


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantRevokeUserAccessIdHandler.java:
##########
@@ -33,26 +30,16 @@
     description = "Revoke user accessId to tenant")
 public class TenantRevokeUserAccessIdHandler extends TenantHandler {
 
-  @CommandLine.Spec
-  private CommandLine.Model.CommandSpec spec;
-
-  @CommandLine.Parameters(description = "List of user accessIds", arity = "1..")
-  private List<String> accessIds = new ArrayList<>();
-
-  // TODO: HDDS-6340. Add an option to print JSON result
+  @CommandLine.Parameters(description = "Access ID", arity = "1..1")
+  private String accessId;
 
   @Override
-  protected void execute(OzoneClient client, OzoneAddress address) {
-    final ObjectStore objStore = client.getObjectStore();
+  protected void execute(OzoneClient client, OzoneAddress address)
+      throws IOException {
 
-    accessIds.forEach(accessId -> {
-      try {
-        objStore.tenantRevokeUserAccessId(accessId);
-        err().format("Revoked accessId '%s'.%n", accessId);
-      } catch (IOException e) {
-        err().format("Failed to revoke accessId '%s': %s%n",
-            accessId, e.getMessage());
-      }
-    });
+    client.getObjectStore().tenantRevokeUserAccessId(accessId);
+    if (isVerbose()) {
+      err().format("Revoked accessId '%s'.%n", accessId);

Review Comment:
   Actually I initially did print this to `stdout`.
   
   But then I don't want to mix the "export" output in `TenantAssignUserAccessIdHandler` (with verbose flag). In that case `export AWS_ACCESS_KEY_ID=..` goes to stdout while "Assigned user to tenant" message goes to stderr.
   
   In the case of revoke user I'm trying to keep the behavior consistent with assign user (i.e. verbose success message both goes to stderr).



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