dchitlangia commented on a change in pull request #1204: HDDS-1768. Audit
xxxAcl methods in OzoneManager
URL: https://github.com/apache/hadoop/pull/1204#discussion_r313697013
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -2999,23 +3016,36 @@ public OmKeyInfo lookupFile(OmKeyArgs args) throws
IOException {
*/
@Override
public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
- if(isAclEnabled) {
- checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL,
- obj.getVolumeName(), obj.getBucketName(), obj.getKeyName());
- }
- // TODO: Audit ACL operation.
- switch (obj.getResourceType()) {
- case VOLUME:
- return volumeManager.addAcl(obj, acl);
- case BUCKET:
- return bucketManager.addAcl(obj, acl);
- case KEY:
- return keyManager.addAcl(obj, acl);
- case PREFIX:
- return prefixManager.addAcl(obj, acl);
- default:
- throw new OMException("Unexpected resource type: " +
- obj.getResourceType(), INVALID_REQUEST);
+ boolean auditSuccess = true;
+
+ try{
+ if(isAclEnabled) {
+ checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL,
+ obj.getVolumeName(), obj.getBucketName(), obj.getKeyName());
+ }
+ switch (obj.getResourceType()) {
+ case VOLUME:
+ return volumeManager.addAcl(obj, acl);
+ case BUCKET:
+ return bucketManager.addAcl(obj, acl);
+ case KEY:
+ return keyManager.addAcl(obj, acl);
+ case PREFIX:
+ return prefixManager.addAcl(obj, acl);
+ default:
+ throw new OMException("Unexpected resource type: " +
+ obj.getResourceType(), INVALID_REQUEST);
+ }
+ } catch(Exception ex) {
+ auditSuccess = false;
+ auditAcl(obj, Arrays.asList(acl), OMAction.ADD_ACL,
Review comment:
@bharatviswa504 I think we can skip this one as throughout this class we are
following this approach of using auditSuccess, mostly for code
readability/correctness.
I think we can discuss with @anuengineer on this. If he is onboard with
this change then we can change it across OM, SCM, DN for audit log. Since that
will be a big enough change, we can do that in separate jira. Does that sound
good?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]