[ 
https://issues.apache.org/jira/browse/RANGER-3824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pradeep Agrawal reassigned RANGER-3824:
---------------------------------------

    Assignee: Pradeep Agrawal

> [Ranger] : /service/tags/resources error message is not proper for duplicate 
> resource & not able to update resource resource
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: RANGER-3824
>                 URL: https://issues.apache.org/jira/browse/RANGER-3824
>             Project: Ranger
>          Issue Type: Bug
>          Components: Ranger
>            Reporter: Anupam Rai
>            Assignee: Pradeep Agrawal
>            Priority: Major
>
> Hi 
> Post request for  /service/tags/resources error message is not proper for 
> duplicate resource.
> Steps to reproduce :
> 1. Make post request to /service/tags/resources API 
> eg :
> {code:java}
> curl --location --request POST 'https://host:6182/service/tags/resources' \
> --header 'Authorization: Basic auth==' \
> --header 'Content-Type: application/json' \
> --data-raw '{"serviceName": "cm_hdfs", "resourceElements": {"path": 
> {"values": ["/dummy/ddddddd"]}}}
> ' {code}
> Response : 400 Bad Request
> {code:java}
> Exception [EclipseLink-4002
> ] (Eclipse Persistence Services - 2.7.7.v20200504-69f2c2b80d): 
> org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key 
> value violates unique constraint 
> "x_service_resource_idx_svc_id_resource_signature"
>   Detail: Key (service_id, resource_signature)=(1, 
> e7bc212b933a480d3dbb6ae3b6168f0482d5d7a1646693c8ba1801ed818ca837) already 
> exists.
> Error Code: 0
> Call: INSERT INTO x_service_resource (id, ADDED_BY_ID, CREATE_TIME, guid, 
> is_enabled, resource_signature, service_id, service_resource_elements_text, 
> tags_text, UPDATE_TIME, UPD_BY_ID, version) VALUES (?, ?, ?, ?, ?, ?, ?, ?, 
> ?, ?, ?, ?)
>     bind => [
>     12 parameters bound
> ] {code}
> Expected : Error message to be proper 
> Condition 1 : updateIfexists = true , should update existing resource
> Condition 2: updateIfexists = False , should give proper error message
> Thanks



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to