You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by "Michal Fojtik (JIRA)" <ji...@apache.org> on 2012/12/05 18:10:01 UTC

[jira] [Resolved] (DTACLOUD-382) JSON parser incompatibility between 1.9.3p194 and 1.9.3p286

     [ https://issues.apache.org/jira/browse/DTACLOUD-382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michal Fojtik resolved DTACLOUD-382.
------------------------------------

    Resolution: Fixed
      Assignee: Michal Fojtik

Patch pushed.
                
> JSON parser incompatibility between 1.9.3p194 and 1.9.3p286
> -----------------------------------------------------------
>
>                 Key: DTACLOUD-382
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-382
>             Project: DeltaCloud
>          Issue Type: Bug
>          Components: CIMI/Frontend
>         Environment: deltacloud-core HEAD (ea5fda91da9f8c061c2c2fa0a267c84501c743fa)
> json_pure-1.7.5
>            Reporter: Michal Fojtik
>            Assignee: Michal Fojtik
>            Priority: Blocker
>              Labels: cimi
>
> I found strange problem with JSON parser under 1.9.3 MRI ruby when you try to create a new Machine.
> Requirements:
>  ~/code/core/server › rbenv versions
> * 1.9.3-p194 (set by /home/mfojtik/code/core/server/.rbenv-version)
>   1.9.3-p286
> How to reproduce:
> 1. Use 1.9.3p194, start Deltacloud API with CIMI frontend, then:
> $ curl -v -X POST --user 'mockuser:mockpassword' -H 'Content-Type: application/json' -d @machine.json http://localhost:3001/cimi/machines
> Results: Everything works perfectly, Machine is created and JSON is returned to console.
> 2. Use 1.9.3p286, start Deltacloud API with CIMI frontend, then:
> $ curl -v -X POST --user 'mockuser:mockpassword' -H 'Content-Type: application/json' -d @machine.json http://localhost:3001/cimi/machines
> Result:
> E, [2012-11-28T11:48:55.665131 #11346] ERROR -- 500: [TypeError] wrong argument type JSON::Pure::Generator::State (expected Data)
> /home/mfojtik/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/json_pure-1.7.5/lib/json/pure/generator.rb:316:in `to_json'
> /home/mfojtik/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/json_pure-1.7.5/lib/json/pure/generator.rb:316:in `block in json_transform'
> /home/mfojtik/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/json_pure-1.7.5/lib/json/pure/generator.rb:309:in `each'
> /home/mfojtik/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/json_pure-1.7.5/lib/json/pure/generator.rb:309:in `json_transform'
> /home/mfojtik/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/json_pure-1.7.5/lib/json/pure/generator.rb:291:in `to_json'
> /home/mfojtik/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/json_pure-1.7.5/lib/json/pure/generator.rb:257:in `generate'
> /home/mfojtik/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/json/common.rb:216:in `generate'
> /home/mfojtik/code/core/server/lib/cimi/models/base.rb:232:in `to_json'
> /home/mfojtik/code/core/server/lib/cimi/models/base.rb:243:in `to_json'
> /home/mfojtik/code/core/server/lib/cimi/collections/machines.rb:58:in `block (5 levels) in <class:Machines>'
> The Machine objects looks like this:
> #<CIMI::Model::Machine:0x000000044423f8 @attribute_values={:id=>"http://localhost:3001/cimi/machines/inst9", :name=>"myMachine1", :description=>"My very first machine", :created=>"2012-11-28T11:48:55+01:00", :property=>{"foo"=>"bar", "life"=>"is life", "machine_image"=>"http://localhost:3001/cimi/machine_images/img1", "credential"=>"http://localhost:3001/cimi/credentials"}, :state=>"STARTED", :cpu=>"1", :memory=>1781760, :disks=>#<Class::DiskCollection:0x00000004441c28 @attribute_values={:id=>nil, :href=>"http://localhost:3001/cimi/machines/inst9/disks", :count=>nil, :disks=>[], :operations=>nil}>, :volumes=>#<Class::MachineVolumeCollection:0x000000044416d8 @attribute_values={:id=>nil, :href=>"http://localhost:3001/cimi/machines/inst9/volumes", :count=>nil, :machine_volumes=>[], :operations=>nil}>, :meters=>nil, :operations=>[{:href=>"http://localhost:3001/cimi/machines/inst9/restart", :rel=>"http://schemas.dmtf.org/cimi/1/action/restart"}, {:href=>"http://localhost:3001/cimi/machines/inst9/stop", :rel=>"http://schemas.dmtf.org/cimi/1/action/stop"}, {:href=>"http://localhost:3001/cimi/machine_images", :rel=>"http://schemas.dmtf.org/cimi/1/action/capture"}]}>
> (nothing suspicious). 
> I think this is caused by something they added to p286, but I was unable to track the problem down. 
> NOTE: This bug is affecting **ALL** JSON output, not just create.
> PS: The @machine.json file:
> {
>   "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineCreate",
>   "name": "myMachine1",
>   "description": "My very first machine",
>   "properties": {
>     "foo": "bar",
>     "life": "is life"
>   },
>   "machineTemplate": {
>     "machineConfig": { "href": " http://localhost:3001/cimi/machine_configurations/m1-small" },
>     "machineImage": { "href": " http://localhost:3001/cimi/machine_images/img1" }
>   }
> }
>  

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