cxorm commented on a change in pull request #94: HDDS-2255. Improve Acl Handler 
Messages
URL: https://github.com/apache/hadoop-ozone/pull/94#discussion_r340004152
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/AddAclKeyHandler.java
 ##########
 @@ -91,10 +91,15 @@ public Void call() throws Exception {
             OzoneObj.StoreType.valueOf(storeType))
         .build();
 
-    boolean result = client.getObjectStore().addAcl(obj,
+    boolean aclExisted = client.getObjectStore().checkAclExist(obj,
         OzoneAcl.parseAcl(acl));
-
-    System.out.printf("%s%n", "Acl added successfully: " + result);
+    if (aclExisted) {
+      System.out.println("ACL already exists.");
+    } else {
+      boolean result = client.getObjectStore().addAcl(obj,
 
 Review comment:
   Yes, thanks @bharatviswa504 for the comment.
   
   And I found that if the acl already exist when we add it, the 
```OMException``` would be thrown by the ```OmOzoneAclMap#addAcl``` result in 
returning false.
   So we don't need ```checkAclExist```.
   
   Fixed.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org

Reply via email to