-
-
Save pccowboy/7662e3ebae0f2257acd9405c1f480272 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Trying to prevent puts that overwrite by using the If-None-Match header, but not working as I expected... | |
[root@9ba10395 (ops) ~]$ mls -li /zettit_ops/stor/docs_test/117/24 | |
-rwxr-xr-x 1 zettit_ops 4 Jan 25 11:08 test | |
-rwxr-xr-x 1 zettit_ops 6 Jan 25 11:37 test2 | |
-rwxr-xr-x 1 zettit_ops 8 Jan 25 11:42 test3 | |
[root@9ba10395 (ops) ~]$ | |
[root@9ba10395 (ops) ~]$ | |
[root@9ba10395 (ops) ~]$ # This one should fail, a version of the resource is present | |
[root@9ba10395 (ops) ~]$ mput -i --header='If-None-Match: *' /zettit_ops/stor/docs_test/117/24/test3 | |
mput: Cannot write because HTTP precondition not met. | |
[root@9ba10395 (ops) ~]$ | |
[root@9ba10395 (ops) ~]$ | |
[root@9ba10395 (ops) ~]$ # This one I expected to complete successfully, but it fails | |
[root@9ba10395 (ops) ~]$ mput -i --header='If-None-Match: *' /zettit_ops/stor/docs_test/117/24/test4 | |
mput: Cannot write because HTTP precondition not met. |
And here is the same result in a session on my instance in joyent's us-east-1 datacenter:
[root@8e1e27f5-cddb-4f31-a898-a69630493fba ~]# mls -l
drwxr-xr-x 1 zettitops 0 Mar 08 2016 .joyent
[root@8e1e27f5-cddb-4f31-a898-a69630493fba ~]# mls -l /$MANTA_USER/stor/
drwxr-xr-x 1 zettitops 0 Mar 08 2016 .joyent
[root@8e1e27f5-cddb-4f31-a898-a69630493fba ~]# mmkdir ~~/stor/documents
[root@8e1e27f5-cddb-4f31-a898-a69630493fba ~]#
[root@8e1e27f5-cddb-4f31-a898-a69630493fba ~]# mls -l ~~/stor/documents
[root@8e1e27f5-cddb-4f31-a898-a69630493fba ~]# mput -v -i --header='If-None-Match: *' ~~/stor/documents/test1
{"name":"mput","hostname":"8e1e27f5-cddb-4f31-a898-a69630493fba","pid":41781,"component":"MantaClient","path":"/zettitops/stor/documents/test1","req_id":"2572c2b5-851a-45aa-a431-2544f06b731f","level":20,"headers":{"accept":"application/json, */*","x-request-id":"2572c2b5-851a-45aa-a431-2544f06b731f"},"id":"2572c2b5-851a-45aa-a431-2544f06b731f","query":{},"msg":"info: entered","time":"2017-01-27T13:11:04.635Z","src":{"file":"/usr/lib/node_modules/manta/lib/client.js","line":1098,"func":"info"},"v":0}
{"name":"mput","hostname":"8e1e27f5-cddb-4f31-a898-a69630493fba","pid":41781,"component":"MantaClient","level":10,"client_req":{"method":"HEAD","url":"/zettitops/stor/documents/test1","address":"us-east.manta.joyent.com","port":null,"headers":{"accept":"application/json, */*","x-request-id":"2572c2b5-851a-45aa-a431-2544f06b731f","date":"Fri, 27 Jan 2017 13:11:04 GMT","authorization":"Signature keyId=\"/zettitops/keys/3b:bc:f3:fd:fa:0f:74:63:84:c0:8c:e6:42:74:3f:3e\",algorithm=\"rsa-sha256\",headers=\"date\",signature=\"dm6uXyILQwgBjTGlvOE0RtIDPh4GR4/3xKTa4gjnyN4WMKBTixu4O2y2bxOa5gYj2Bl38EFoJ64JWvM28aJhji1MB80Vd3DNCIlciBumEUuo6WibVG8/7FiJu5qOstFhnsMMezbKQiqftpLo7/Jd5llBDuEZlacj3vJpkNYZLJ8oZjslHOMBK5jxDj9gB7OoLoe74uasbqtIymgrHuBFiRm07feAyEGEV+H2GP0FxDqXr0DAnKbRuYigYmTB354qRY2UnpNA1hA+v03sFqtY3ZUXdFUm5N2ehDK0oWyaznIl+n6cyXFzs5Z1c87AXlU7VCyMb3KyG642Bz3C3O4/Sw==\"","if-none-match":"*","user-agent":"restify/1.3.0 (x64-linux; v8/5.1.281.83; OpenSSL/1.0.2h) node/6.6.0","accept-version":"~1.0"}},"msg":"request sent","time":"2017-01-27T13:11:05.045Z","src":{"file":"/usr/lib/node_modules/manta/node_modules/restify-clients/lib/HttpClient.js","line":314,"func":"rawRequest"},"v":0}
{"name":"mput","hostname":"8e1e27f5-cddb-4f31-a898-a69630493fba","pid":41781,"component":"MantaClient","level":10,"client_res":{"statusCode":404,"headers":{"content-type":"application/json","content-length":"85","content-md5":"yVzJZ4p0QX65yWIXhfV0lg==","date":"Fri, 27 Jan 2017 13:11:05 GMT","server":"Manta","x-request-id":"2572c2b5-851a-45aa-a431-2544f06b731f","x-response-time":"14","x-server-name":"c84b3cab-1c20-4566-a880-0e202b6b63dd","connection":"keep-alive","x-request-received":1485522664932,"x-request-processing-time":303}},"msg":"Response received","time":"2017-01-27T13:11:05.236Z","src":{"file":"/usr/lib/node_modules/manta/node_modules/restify-clients/lib/HttpClient.js","line":210,"func":"onResponse"},"v":0}
{"name":"mput","hostname":"8e1e27f5-cddb-4f31-a898-a69630493fba","pid":41781,"component":"MantaClient","path":"/zettitops/stor/documents/test1","req_id":"2f7e1891-8177-4fbb-b186-c715334c7d4c","level":20,"headers":{"if-none-match":"*","accept":"application/json","content-type":"application/octet-stream","expect":"100-continue","x-request-id":"2f7e1891-8177-4fbb-b186-c715334c7d4c","x-durability-level":2,"transfer-encoding":"chunked"},"id":"2f7e1891-8177-4fbb-b186-c715334c7d4c","query":{},"_original_path":"/zettitops/stor/documents/test1","msg":"put: entered","time":"2017-01-27T13:11:05.270Z","src":{"file":"/usr/lib/node_modules/manta/lib/client.js","line":1842,"func":"put"},"v":0}
{"name":"mput","hostname":"8e1e27f5-cddb-4f31-a898-a69630493fba","pid":41781,"component":"MantaClient","level":10,"client_req":{"method":"PUT","url":"/zettitops/stor/documents/test1","address":"us-east.manta.joyent.com","port":null,"headers":{"if-none-match":"*","accept":"application/json","content-type":"application/octet-stream","expect":"100-continue","x-request-id":"2f7e1891-8177-4fbb-b186-c715334c7d4c","x-durability-level":2,"transfer-encoding":"chunked","date":"Fri, 27 Jan 2017 13:11:05 GMT","authorization":"Signature keyId=\"/zettitops/keys/3b:bc:f3:fd:fa:0f:74:63:84:c0:8c:e6:42:74:3f:3e\",algorithm=\"rsa-sha256\",headers=\"date\",signature=\"liWrr85jTeX0ix3n6m3clk0LQpMhsPM1ButjwMXwvYkiB1NVJQxaacOThpSlIdYkUfsmVceJ/7SywKITH9CaLW3bTaqhAKIhDj/6GutjFam44pGyoDK7VBuo7jNWknS5G7aQ0bUuLBXAcDc0Gg9WZlB1QIBrxF1gftUWh26DxkVRKNUy37yul1ipiqcJKeMHy3EJ4pbU9+hjGGVJ6lusVRtPQ+Z+Pji6K6jmvrw17gtUsnznWY0jmo+82km5lH1o8c5T9UBDZG0IX7hqqAU57CYf1QLJOIKtGEQmCd3QkI3retgSLy80onIaoKZ6Nd1TNvJ3bBMIyW9c5QEPprhVNA==\"","user-agent":"restify/1.3.0 (x64-linux; v8/5.1.281.83; OpenSSL/1.0.2h) node/6.6.0","accept-version":"~1.0"}},"msg":"request sent","time":"2017-01-27T13:11:05.361Z","src":{"file":"/usr/lib/node_modules/manta/node_modules/restify-clients/lib/HttpClient.js","line":314,"func":"rawRequest"},"v":0}
{"name":"mput","hostname":"8e1e27f5-cddb-4f31-a898-a69630493fba","pid":41781,"component":"MantaClient","level":10,"client_res":{"statusCode":412,"headers":{"content-type":"application/json","content-length":"75","content-md5":"qMAMT1aHkWKjDs+hD3fb1g==","date":"Fri, 27 Jan 2017 13:11:05 GMT","server":"Manta","x-request-id":"2f7e1891-8177-4fbb-b186-c715334c7d4c","x-response-time":"16","x-server-name":"511ea59e-2a4a-486b-9258-ef59016d064d","connection":"close","x-request-received":1485522665323,"x-request-processing-time":83}},"msg":"Response received","time":"2017-01-27T13:11:05.407Z","src":{"file":"/usr/lib/node_modules/manta/node_modules/restify-clients/lib/HttpClient.js","line":210,"func":"onResponse"},"v":0}
{"name":"mput","hostname":"8e1e27f5-cddb-4f31-a898-a69630493fba","pid":41781,"component":"MantaClient","path":"/zettitops/stor/documents/test1","req_id":"2f7e1891-8177-4fbb-b186-c715334c7d4c","level":20,"err":{"message":"if-none-match '*' matched etag ''","name":"PreconditionFailedError","stack":"PreconditionFailedError: if-none-match '*' matched etag ''\n at ClientRequest.onResponse (/usr/lib/node_modules/manta/node_modules/restify-clients/lib/HttpClient.js:217:26)\n at ClientRequest.g (events.js:291:16)\n at emitOne (events.js:96:13)\n at ClientRequest.emit (events.js:188:7)\n at HTTPParser.parserOnIncomingClient (_http_client.js:472:21)\n at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)\n at TLSSocket.socketOnData (_http_client.js:361:20)\n at emitOne (events.js:96:13)\n at TLSSocket.emit (events.js:188:7)\n at readableAddChunk (_stream_readable.js:176:18)","code":"PreconditionFailed"},"msg":"put: error","time":"2017-01-27T13:11:05.421Z","src":{"file":"/usr/lib/node_modules/manta/lib/client.js","line":330,"func":"onReadDone"},"v":0}
mput: Cannot write because HTTP precondition not met.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For comparison, here is the request and response object from a perl LWP sessions, where I am trying to PUT a new document:
The directory contains: