[
https://issues.apache.org/jira/browse/DTACLOUD-357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13492191#comment-13492191
]
Marios Andreou commented on DTACLOUD-357:
-----------------------------------------
forgot to add the XML example in addition to your json one above:
[marios@name deltacloud]$ curl --user "mockuser:mockpassword" -X POST -H
"Content-Type: application/xml" -d '<MachineCreate
xmlns="http://schemas.dmtf.org/cimi/1"> <name> myMachine1 </name> <description>
my machine </description> <machineTemplate> <machineConfig
href="http://localhost:3001/cimi/machine_configurations/m1-small">
</machineConfig> <machineImage
href="http://localhost:3001/cimi/machine_images/img1"> </machineImage>
</machineTemplate> </MachineCreate>' http://localhost:3001/cimi/machines
> can't create machine using CIMI front-end with json POST
> --------------------------------------------------------
>
> Key: DTACLOUD-357
> URL: https://issues.apache.org/jira/browse/DTACLOUD-357
> Project: DeltaCloud
> Issue Type: Bug
> Components: CIMI/Frontend
> Reporter: Dies Koper
> Assignee: Marios Andreou
> Attachments:
> 0001-CIMI-replace-json-and-xml-for-expected-content-types.patch,
> 0002-CIMI-fix-json-parsing-for-create-Machine.patch,
> 0003-CIMI-default-to-a-content-type-for-response-when-cim.patch
>
>
> curl --user "user:pwd" -X POST http://localhost:3001/cimi/machines -H
> "Content-Type: application/json" -d POST.json
> with
> { "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineCreate", "name":
> "myMachine1", "description": "My very first machine", "machineTemplate": {
> "machineConfig": { "href":
> "http://localhost:3001/cimi/machine_configurations/economy" },
> "machineImage": { "href":
> "http://localhost:3001/cimi/machine_images/IMG_3c9820_S24FWXU0Q9VH0JK" } } }
> gives:
> 500: [ArgumentError] File does not exist
> from gems/xml-simple-1.1.1/lib/xmlsimple.rb:990:in `find_xml_file'
> from deltacloud/server/lib/cimi/models/machine.rb:59:in `create_from_xml'
> I'm posting json data!
> DC code has if request.content_type.end_with?("+json")
> else xml
> which is suspicious.
> When I change my content type to +json, I get [NameError] undefined local
> variable or method `xml' for CIMI::Model::Machine:Class
> in
> hardware_profile_id =
> xml['machineTemplate']['machineConfig']["href"].split('/').last
> Looks like the json method has been copied & pasted from the xml one?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira