[openstack-dev] Barbican : Unable to create the container with the POST request using the CURL command

Douglas Mendizabal douglas.mendizabal at RACKSPACE.COM
Mon Mar 16 22:33:30 UTC 2015


HI Asha,

It looks like your curl command is malformed, which is why you’re getting all the curl errors.  You need to quote the entirety of the payload, like so:

curl -X POST -H 'content-type:application/json' -H 'X-Project-Id: 12345' -d '{ "name": "container1" ,"type": "rsa","secret_refs": [ { "name": "private_key", "secret_ref":"http://localhost:9311/v1/secrets/b9e474a4-aed9-4d5b-98a7-5f2127aad81f" }, { "name": "public_key", "secret_ref":"http://localhost:9311/v1/secrets/c49e4b6a-7ec1-4a81-9ee5-58647102e5b6" } , { "name": "private_key_passphrase", "secret_ref":"http://localhost:9311/v1/secrets/3cd2fdc8-e30d-4f33-a1d8-81aa0bc2c47e" } ] }' http://localhost:9311/v1/containers

Or else your shell splits the payload and you get all the errors you listed.

-Doug

--------------------
Douglas Mendizábal
IRC: redrobot
PGP Key: 245C 7B6F 70E9 D8F3 F5D5  0CC9 AD14 1F30 2D58 923C

On Mar 16, 2015, at 5:24 PM, Asha Seshagiri <asha.seshagiri at gmail.com<mailto:asha.seshagiri at gmail.com>> wrote:

Hi All,

Could any one help me out with the execution of the command for creating the container .
Please find the command and the response below :

root at barbican:~# curl -X POST -H 'content-type:application/json' -H 'X-Project-Id: 12345' -d { "name": "container1" ,"type": "rsa","secret_refs": [ { "name": "private_key", "secret_ref":"http://localhost:9311/v1/secrets/b9e474a4-aed9-4d5b-98a7-5f2127aad81f" }, { "name": "public_key", "secret_ref":"http://localhost:9311/v1/secrets/c49e4b6a-7ec1-4a81-9ee5-58647102e5b6" } , { "name": "private_key_passphrase", "secret_ref":"http://localhost:9311/v1/secrets/3cd2fdc8-e30d-4f33-a1d8-81aa0bc2c47e" } ] } http://localhost:9311/v1/containers
curl: (6) Could not resolve host: name
curl: (6) Could not resolve host: container1
curl: (6) Could not resolve host: ,type
curl: (6) Could not resolve host: rsa,secret_refs
curl: (3) [globbing] bad range specification in column 2
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: name
curl: (6) Could not resolve host: private_key,
curl: (6) Could not resolve host: secret_ref:http
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: name
curl: (6) Could not resolve host: public_key,
curl: (6) Could not resolve host: secret_ref:http
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (6) Could not resolve host: ,
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: name
curl: (6) Could not resolve host: private_key_passphrase,
curl: (6) Could not resolve host: secret_ref:http
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 1
{"code": 400, "description": "Malformed JSON", "title": "Bad Request"}root at barbican:~#

Also I got the secret references by using the following command and selected the highlighted secret from the list  :

url -H 'Accept: application/json' -H 'X-Project-Id:12345' http://localhost:9311/v1/secrets                                                            {"secrets": [{"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-10T21:23:52.843606", "name": null, "algorithm": null, "created": "2015-03-10T21:23:52.838400", "secret_ref": "http://localhost:9311/v1/secrets/de9502e5-42b2-4b17-8d8b-932dbc40604e", "content_types": {"default": "text/plain"}, "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-10T21:40:10.476840", "name": null, "algorithm": null, "created": "2015-03-10T21:40:10.473810", "secret_ref": "http://localhost:9311/v1/secrets/a7af62f1-b763-4643-813f-e268326967e3", "content_types": {"default": "text/plain"}, "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-11T19:02:03.381427", "name": null, "algorithm": null, "created": "2015-03-11T19:02:03.381427", "secret_ref": "http://localhost:9311/v1/secrets/b9e474a4-aed9-4d5b-98a7-5f2127aad81f", "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-11T21:36:11.555639", "name": null, "algorithm": null, "created": "2015-03-11T21:36:11.555639", "secret_ref": "http://localhost:9311/v1/secrets/c49e4b6a-7ec1-4a81-9ee5-58647102e5b6", "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-11T22:22:49.473581", "name": null, "algorithm": null, "created": "2015-03-11T22:22:49.473581", "secret_ref": "http://localhost:9311/v1/secrets/5ebc1454-785f-4001-bc22-dd25957e8de3", "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-13T15:25:35.989442", "name": null, "algorithm": null, "created": "2015-03-13T15:25:35.989442", "secret_ref": "http://localhost:9311/v1/secrets/13c7c239-0571-4471-820c-7f782855ee67", "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-13T15:38:14.930289", "name": null, "algorithm": null, "created": "2015-03-13T15:37:16.926344", "secret_ref": "http://localhost:9311/v1/secrets/3cd2fdc8-e30d-4f33-a1d8-81aa0bc2c47e", "content_types": {"default": "text/plain"}, "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-13T15:42:44.570773", "name": null, "algorithm": null, "created": "2015-03-13T15:40:55.906374", "secret_ref": "http://localhost:9311/v1/secrets/51cce32e-2427-4d84-8853-6b90d52e7d96", "content_types": {"default": "application/octet-stream"}, "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-13T19:55:59.922138", "name": null, "algorithm": null, "created": "2015-03-13T19:55:59.919010", "secret_ref": "http://localhost:9311/v1/secrets/9ae128cb-072c-491c-8cfd-2b82d82e44e5", "content_types": {"default": "text/plain"}, "expiration": null, "bit_length": null, "mode": null}, {"status": "ACTIVE", "secret_type": "opaque", "updated": "2015-03-13T20:02:12.341703", "name": null, "algorithm": null, "created": "2015-03-13T20:02:12.338562", "secret_ref": "http://localhost:9311/v1/secrets/9fcae609-49a1-450a-bbe6-c28238bb1671", "content_types": {"default": "text/plain"}, "expiration": null, "bit_length": null, "mode": null}], "total": 12, "next": "http://localhost:9311/v1/secrets?limit=10&offset=10"}root at barbican:~#

Thanks in advance.
--
Thanks and Regards,
Asha Seshagiri
__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: OpenStack-dev-request at lists.openstack.org<mailto:OpenStack-dev-request at lists.openstack.org>?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150316/62c6c7be/attachment.html>


More information about the OpenStack-dev mailing list