You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Selvamohan Neethiraj <sn...@apache.org> on 2015/01/23 15:14:14 UTC

Re: Regarding Ranger Contribution

Hi Shrey/Hanish:

Here is the process for contributing code/patches to Apache Ranger:

=====================================================================================================
Initial Ranger Repo Creation
You should be able to pull the ranger code into your local machine.

$ git clone git://git.apache.org/incubator-ranger.git <git://git.apache.org/incubator-ranger.git>

(Alternate option is to create a forked repo based on git@github.com:apache/incubator-ranger.git and work from this repo)


Resolving Apache Ranger JIRA and submitting patch

1. pick a JIRA to resolve
    ** If you need to propose any specific design changes, please attach a document with proposed changes them in the JIRA and send out an email w/ the document to dev group (dev@ranger.incubator.apache.org)

2. make necessary code changes in your local repo & test your changes
    ** make sure that you have enough unit-test to cover all of the changes

3. commit changes to your local repo with the commit comment with apache JIRA number as follows …

$ git add <modified|add|deleted-files>
$ git commit -m “RANGER-<JIRANUMBER>: <description of the JIRA fix>”

After you committed your change into your local repo, you should be able to create a patch using the following command:

$ git format-patch -n HEAD~

This command should create a git patch file under the current directory. Attach the patch file to the Apache JIRA and provide your comment about the solution.
An Apache Ranger committer should be able to review your patch and provide feedback or commit to Apache Ranger Repository.

For pulling latest source changes from Apache Ranger, you can execute the following command to get latest code changes from remote apache repo to your local repo:

$ git pull

=====================================================================================================

If you have any questions related to Apache Ranger development questions, please feel free to contact me or post an email to the dev group.


Thanks,
Selva-



> On Jan 23, 2015, at 7:57 AM, Shrey Mehrotra <sh...@impetus.co.in> wrote:
> 
> Hi,
>  
> Hope you are doing good. It would be helpful if you brief us about the process of contribution. What branch we need to start working on for jira changes?
>  
> Thanks & Regards,
> Shrey Mehrotra
> Senior Software Engineer, iLabs
> Impetus Infotech Pvt. Ltd.
>  
> From: Hanish Bansal 
> Sent: Wednesday, December 31, 2014 1:11 PM
> To: Don Bosco Durai
> Cc: Selvamohan Neethiraj; Shrey Mehrotra
> Subject: RE: Issues in Delete Rest Api
>  
> ​+ Shrey
>  
> Thanks for providing us the opportunity to contribute to Apache Ranger. Please guide us through the procedure to make and commit changes in current Ranger Repository. We would start working on the JIRAs that we have created. 
> ​
> 
> -------
> Thanks & Regards,
> Hanish Bansal
> Software Engineer, iLabs
> Impetus Infotech Pvt. Ltd.
> From: Don Bosco Durai <bosco@apache.org <ma...@apache.org>>
> Sent: Wednesday, December 31, 2014 12:13 PM
> To: Hanish Bansal
> Cc: Selvamohan Neethiraj
> Subject: Re: Issues in Delete Rest Api
>  
> + Selva
>  
> Hanish
>  
> Thanks for creating the JIRAs.
>  
> Both you and your college Shrey is welcome to contribute. Please go over the code and also let us know what you are interested in working on. You could also start with the JIRA you just created :-)
>  
> Regarding the REST APIs and documentation, we need to do lot of work. There are two types of REST APIs. One set is primarily used by the UI and considered for internal use. We have public facing REST APIs for managing policies. We are going to document them soon.
>  
> Feel free to create documentation or send it over to us. 
>  
> Thanks
>  
> Bosco
>  
>  
>  
> On Dec 29, 2014, at 7:26 PM, Hanish Bansal <hanish.bansal@impetus.co.in <ma...@impetus.co.in>> wrote:
>  
> Hi Don Bosco,
>  
> I have filed jiras for tracking these issues:
>  
> https://issues.apache.org/jira/browse/RANGER-204 <https://issues.apache.org/jira/browse/RANGER-204>
>  
> https://issues.apache.org/jira/browse/RANGER-205 <https://issues.apache.org/jira/browse/RANGER-205>
>  
> Yes, I would like to contribute. I have one other member(Shrey Mehotra) in my team who is also interested to contribute.
>  
> We would start by exploring the source code.
>  
> Also there is one another thing I would like to highlight, details of rest apis that ranger provides is not provided yet anywhere. Users who are exploring/using ranger, facing issues to find the details. I shared the rest apis details on this forum yesterday. Please look into that and if it looks good to you then put the same on ranger wiki/guide.
>  
> Hoping to hear from you soon.
>  
> -------
> Thanks & Regards,
> Hanish Bansal
> Software Engineer, iLabs
> From: Hanish Bansal <hanish.bansal.agarwal@gmail.com <ma...@gmail.com>>
> Sent: Tuesday, December 30, 2014 8:39 AM
> To: Hanish Bansal
> Subject: Fwd: Issues in Delete Rest Api
>  
>  
> ---------- Forwarded message ----------
> From: Don Bosco Durai <bosco@apache.org <ma...@apache.org>>
> Date: Sat, Dec 27, 2014 at 1:19 AM
> Subject: Re: Issues in Delete Rest Api
> To: user@ranger.incubator.apache.org <ma...@ranger.incubator.apache.org>
> 
> Hi Hanish
>  
> The delete REST APIs are not currently supported. The main reason is as you pointed out, we need to address the dependencies properly. Can you create a JIRA to track this issue and requirement? Also, let us know if you want to contribute resolving any of these issues.
>  
> Thanks
>  
> Bosco
>  
>  
> On Dec 26, 2014, at 3:04 AM, Hanish Bansal <hanish.bansal.agarwal@gmail.com <ma...@gmail.com>> wrote:
>  
> Hi All,
> I am exploring REST APIs of ranger for delete operation.
> Delete rest api to delete a user/group, should delete that user/group from database and as well as all references of that user/group from all tables of database.
> I am facing below issues:
> 1.
> If a user or group has some policy assigned (entry in x_perm_map) then I am not able to delete that user/group. I get 404 not found error in my rest client that is not proper exception message.
> In log file catalina.out I am getting below exception message:
> 
> [EL Warning]: 2014-12-26 16:24:02.643--UnitOfWork(382747336)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`ranger`.`x_perm_map`, CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`))
> Error Code: 1451
> Call: DELETE FROM x_group WHERE (ID = ?)
>     bind => [1 parameter bound]
> Query: DeleteObjectQuery(XXGroup={XXDBBase={createTime={Thu Dec 25 12:41:06 IST 2014} updateTime={Thu Dec 25 12:41:06 IST 2014} addedByUserId={1} updatedByUserId={1} }name={Group5} description={} status={0} groupType={0} credStoreId={null} groupSrc={0} })
> Dec 26, 2014 4:24:02 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
> SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
> javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`ranger`.`x_perm_map`, CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`))
> Error Code: 1451
> Call: DELETE FROM x_group WHERE (ID = ?)
>     bind => [1 parameter bound]
> Query: DeleteObjectQuery(XXGroup={XXDBBase={createTime={Thu Dec 25 12:41:06 IST 2014} updateTime={Thu Dec 25 12:41:06 IST 2014} addedByUserId={1} updatedByUserId={1} }name={Group5} description={} status={0} groupType={0} credStoreId={null} groupSrc={0} })
>     at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:868)
>     at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
>     at com.sun.proxy.$Proxy20.flush(Unknown Source)
>     at org.apache.ranger.common.db.BaseDao.remove(BaseDao.java:106)
>     at org.apache.ranger.common.db.BaseDao.remove(BaseDao.java:97)
>     at org.apache.ranger.biz.XUserMgr.deleteXGroup(XUserMgr.java:77)
>     at org.apache.ranger.rest.XUserREST.deleteXGroupByGroupName(XUserREST.java:545)
>     at org.apache.ranger.rest.XUserREST$$FastClassByCGLIB$$b2a65360.invoke(<generated>)
>     at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
>     at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
>     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>     at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
>     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>     at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
>     at org.apache.ranger.rest.XUserREST$$EnhancerByCGLIB$$246afd5.deleteXGroupByGroupName(<generated>)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$VoidOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:151)
>     at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70)
>     at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279)
>     at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
>     at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86)
>     at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
>     at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
>     at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1357)
>     at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1289)
>     at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1239)
>     at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229)
>     at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
>     at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497)
>     at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:684)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>     at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)
>     at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
>     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
>     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
>     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
>     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
>     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
>     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
>     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
>     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
>     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
>     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
>     at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>     at java.lang.Thread.run(Thread.java:744)
> Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`ranger`.`x_perm_map`, CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`))
> If user don't have any policy assigned then user/group get successfully deleted. Also mapping of user-group get deleted from database(x_group_users table), which is expected behavior. 
> 2.
> After deleting a user I am not able to create a user with username or email-id of deleted user. I am getting message that this user with this email/user-name already exists.
> I debugged and found that delete rest api is removing entry from x_user table of database and not from x_portal_user table.
> Expected behavior should be : When user is deleted then it should also get deleted from x_portal_user table.
>  
> Please let me know why I am getting this behavior.
>  
> 
> 
> 
> -- 
> Thanks & Regards
> Hanish Bansal
>  
> 
> 
> 
> 
> 
> 
> NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.
>  
> 
> 
> 
> 
> 
> 
> 
> NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.