EUDAT-B2HANDLE / B2HANDLE

B2Handle Python library for interaction with Handle services
https://eudat-b2handle.github.io/
Apache License 2.0
22 stars 24 forks source link

adding handle with credentials and overwrite=false fails #53

Closed cookie33 closed 8 years ago

cookie33 commented 8 years ago

Hi,

When creating a handle with credentials and overwrite is false following happens:

DEBUG:b2handle.handleclient:register_handle...
DEBUG:b2handle.handleclient:retrieve_handle_record_json...
DEBUG:b2handle.handlesystemconnector:make_handle_URL...
DEBUG:b2handle.handlesystemconnector:GET Request to https://url:port/api/handles/841/5c61983c-f58b-11e5-a304-5254000df0ed
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): url
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/handles/841/5c61983c-f58b-11e5-a304-5254000df0ed HTTP/1.1" 404 72
DEBUG:b2handle.handlesystemconnector:make_handle_URL...
DEBUG:b2handle.handlesystemconnector:PUT Request to https://urll:port/api/handles/841/5c61983c-f58b-11e5-a304-5254000df0ed?overwrite=false
DEBUG:b2handle.handlesystemconnector:PUT Request payload: {"values": [{"index": 100, "type": "HS_ADMIN", "data": {"value": {"index": 200, "handle": "0.NA/841", "permissions": "011111110011"}, "format": "admin"}}, {"index": 1, "type": "URL", "data": "www.test.com"}]}
DEBUG:b2handle.handlesystemconnector:PUT Request with certificates: headers{'Content-Type': 'application/json', 'Authorization': 'Handle clientCert="true"'}
DEBUG:b2handle.handlesystemconnector:PUT Request with certificates: certificate(u'/home/robertv/test/350_841_ADMIN_certificate_only.pem', u'/home/robertv/test/350_841_ADMIN_privkey.pem')ts.packages.urllib3.connectionpool:"PUT /api/handles/841/5c61983c-f58b-11e5-a304-5254000df0ed?overwrite=false HTTP/1.1" 401 72

When creating a handle with credentials an overwrite is true following happens:

DEBUG:b2handle.handleclient:register_handle...
DEBUG:b2handle.handlesystemconnector:make_handle_URL...
DEBUG:b2handle.handlesystemconnector:PUT Request to https://url:port/api/handles/841/30c57336-f58d-11e5-bee0-5254000df0ed?overwrite=true
DEBUG:b2handle.handlesystemconnector:PUT Request payload: {"values": [{"index": 100, "type": "HS_ADMIN", "data": {"value": {"index": 200, "handle": "0.NA/841", "permissions": "011111110011"}, "format": "admin"}}, {"index": 1, "type": "URL", "data": "www.test.com"}]}
DEBUG:b2handle.handlesystemconnector:PUT Request with certificates
DEBUG:b2handle.handlesystemconnector:PUT Request with certificates: headers{'Content-Type': 'application/json', 'Authorization': 'Handle clientCert="true"'}
DEBUG:b2handle.handlesystemconnector:PUT Request with certificates: certificate(u'/home/robertv/test/350_841_ADMIN_certificate_only.pem', u'/home/robertv/test/350_841_ADMIN_privkey.pem')
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): url
DEBUG:requests.packages.urllib3.connectionpool:"PUT /api/handles/841/30c57336-f58d-11e5-bee0-5254000df0ed?overwrite=true HTTP/1.1" 201 None
INFO:b2handle.handleclient:Handle registered: 841/30c57336-f58d-11e5-bee0-5254000df0ed

The handle is created...

In each case the credentials files are the same.

Does this have something to do with the creation of the session in the first case for read access and later using it to create a handle. So it is NOT in the same mode?

cookie33 commented 8 years ago

The handle access logfile shows for the overwrite is false:

HTTP:HDLApi "2016-03-29 10:51:00.491+0200" 1 100 54ms  841/5c61983c-f58b-11e5-a304-5254000df0ed
HTTP:HDLApi "2016-03-29 10:51:00.531+0200" 100 402 1ms  841/5c61983c-f58b-11e5-a304-5254000df0ed

The handle access logfile shows for the overwrite is true:

HTTP:HDLApi "2016-03-29 11:04:06.319+0200" 100 1 18ms adm=350:841/ADMIN 841/30c57336-f58d-11e5-bee0-5254000df0ed

It uses the credentials to do the creation in the second case.

merretbuurman commented 8 years ago

Issue closed, see PR #54 , this will be release 1.0.1.