Re: Ranger REST API and Kafka policies

2016-06-14 Thread Lune Silver
Hey Ramesh.

Two things :
1. I retried the REST API v2
2. I managed to find the error message.It is located in catalina.out in
fact.

Here is the REST API command that I do to create a kafka policy :
###
curl -iv -k -u amb_ranger_admin -H "Content-Type: application/json" -X POST
https://:6182/service/public/v2/api/policy -d
'{"allowExceptions": [],"denyExceptions": [],"denyPolicyItems":
[],"description": "My first Kafka policy","isAuditEnabled":
true,"isEnabled": true,"name": "kafka_policy_1","policyItems":
[{"accesses": [{"isAllowed": true,"type": "consume"}],"conditions":
[],"delegateAdmin": false,"groups": ["mygroup"],"users": []}],"resources":
{"topic": {"isExcludes": false,"isRecursive": false,"values":
["ambari_kafka_service_check"]},},"service": "MYCLUSTER_kafka","version":
1}'
###

And here is the error message :
###
SEVERE: The exception contained within MappableContainerException could not
be mapped to a response, re-throwing to the HTTP container
org.codehaus.jackson.JsonParseException: Unexpected character ('}' (code
125)): was expecting double-quote to start field name
 at [Source: org.apache.catalina.connector.CoyoteInputStream@6afe90cc;
line: 1, column: 441]
at
org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1291)
at
org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385)
at
org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306)
at
org.codehaus.jackson.impl.Utf8StreamParser._handleUnusualFieldName(Utf8StreamParser.java:1026)
at
org.codehaus.jackson.impl.Utf8StreamParser._parseFieldName(Utf8StreamParser.java:716)
at
org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:325)
at
org.codehaus.jackson.map.deser.MapDeserializer._readAndBind(MapDeserializer.java:220)
at
org.codehaus.jackson.map.deser.MapDeserializer.deserialize(MapDeserializer.java:165)
at
org.codehaus.jackson.map.deser.MapDeserializer.deserialize(MapDeserializer.java:25)
at
org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:230)
at
org.codehaus.jackson.map.deser.SettableBeanProperty$FieldProperty.deserializeAndSet(SettableBeanProperty.java:477)
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:494)
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:350)
at
org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2372)
at
org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1162)
at
org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:410)
at
com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.readFrom(JacksonProviderProxy.java:90)
at
com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:454)
at
com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123)
at
com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46)
at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:138)
at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:166)
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)

Re: Ranger REST API and Kafka policies

2016-06-13 Thread Lune Silver
Hey Ramesh.

I'm gonna dig in this file and come back tomorrow morning with this.

Didn't see anything but I'm gonna to reproduce the problem while tailing
this log.

BR.

Lune.
Le 13 juin 2016 20:36, "Ramesh Mani"  a écrit :

> Lune,
>
> Do you see any exceptions in xa_portal.log when you do this rest call ?
> This will give some idea of what is wrong.
>
> Thanks,
> Ramesh
>
> From: Lune Silver 
> Reply-To: "user@ranger.incubator.apache.org" <
> user@ranger.incubator.apache.org>
> Date: Monday, June 13, 2016 at 8:19 AM
> To: "user@ranger.incubator.apache.org" 
> Subject: Ranger REST API and Kafka policies
>
> Hello !
>
> Sorry to spam the mailing list, but I have another topic.
>
> With the HDP 2.3.4, is it possible to create kafka policies with the REST
> API ?
>
> I tried to use the API v2 from the wiki, but I think the API v2 is not
> taken into account in this version.
>
> https://cwiki.apache.org/confluence/display/RANGER/REST+APIs+for+Service+Definition%2C+Service+and+Policy+Management
>
> I keep getting a 404 not found error when I use this v2 API.
>
> I tried with the API v1 (the one described in the 0.1 of Ranger in the
> wiki) but I didn't find anything relative to kafka.
>
> https://cwiki.apache.org/confluence/display/RANGER/REST+APIs+for+Policy+Management
>
> BR.
>
> Lune.
>


Re: Ranger REST API and Kafka policies

2016-06-13 Thread Ramesh Mani
Lune,

Do you see any exceptions in xa_portal.log when you do this rest call ? This 
will give some idea of what is wrong.

Thanks,
Ramesh

From: Lune Silver >
Reply-To: 
"user@ranger.incubator.apache.org" 
>
Date: Monday, June 13, 2016 at 8:19 AM
To: "user@ranger.incubator.apache.org" 
>
Subject: Ranger REST API and Kafka policies

Hello !

Sorry to spam the mailing list, but I have another topic.

With the HDP 2.3.4, is it possible to create kafka policies with the REST API ?

I tried to use the API v2 from the wiki, but I think the API v2 is not taken 
into account in this version.
https://cwiki.apache.org/confluence/display/RANGER/REST+APIs+for+Service+Definition%2C+Service+and+Policy+Management

I keep getting a 404 not found error when I use this v2 API.

I tried with the API v1 (the one described in the 0.1 of Ranger in the wiki) 
but I didn't find anything relative to kafka.
https://cwiki.apache.org/confluence/display/RANGER/REST+APIs+for+Policy+Management

BR.

Lune.