You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by "Dies Koper (JIRA)" <ji...@apache.org> on 2012/11/07 06:54:12 UTC

[jira] [Created] (DTACLOUD-357) can't create machine using CIMI front-end with json POST

Dies Koper created DTACLOUD-357:
-----------------------------------

             Summary: 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


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

[jira] [Commented] (DTACLOUD-357) can't create machine using CIMI front-end with json POST

Posted by "Marios Andreou (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Assigned] (DTACLOUD-357) can't create machine using CIMI front-end with json POST

Posted by "Marios Andreou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DTACLOUD-357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marios Andreou reassigned DTACLOUD-357:
---------------------------------------

    Assignee: Marios Andreou
    
> 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

[jira] [Updated] (DTACLOUD-357) can't create machine using CIMI front-end with json POST

Posted by "Marios Andreou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DTACLOUD-357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marios Andreou updated DTACLOUD-357:
------------------------------------

    Attachment: 0003-CIMI-default-to-a-content-type-for-response-when-cim.patch
                0002-CIMI-fix-json-parsing-for-create-Machine.patch
                0001-CIMI-replace-json-and-xml-for-expected-content-types.patch
    
> 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

[jira] [Commented] (DTACLOUD-357) can't create machine using CIMI front-end with json POST

Posted by "Marios Andreou (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DTACLOUD-357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13492188#comment-13492188 ] 

Marios Andreou commented on DTACLOUD-357:
-----------------------------------------

Dies - thanks for reporting this. 

The "+json" bit was because in earlier version of the (then) work-in-progress CIMI spec, every entity had it's own content type. So Machine create was like "application/MachineCreate+json" for example (something like that anyway - forget exact syntax). Thankfully we managed to convince the group that this was unnecessary and so we now just have the much more sensible "application/json" and "application/xml". Patch 1 here removes these old references.

Patch 2 fixes the error in the json parsing and Patch 3 makes sure the server defaults to one of xml/json when a cimi request is being handled (deltacloud requests can also do html).

NOTE: the returned XML/JSON may not be perfect. We are going to be working on the CIMI impl. over the next 
few days/weeks. However I believe the patches here address the concerns raised in this ticket.

(patches also available @ http://tracker.deltacloud.org/set/116)

thanks! marios
                
> 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