[
https://issues.apache.org/jira/browse/DTACLOUD-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13563226#comment-13563226
]
David Lutterkort edited comment on DTACLOUD-432 at 1/26/13 12:53 AM:
---------------------------------------------------------------------
It took me a while to figure this out: your shell is taking you to the
cleaners, as $select and $expand get replaced with nothing by your shell.
Enclose the URL in single quotes and you get:
curl -H 'Accept: application/xml' -i --user "mockuser:mockpassword"
'http://localhost:3001/cimi/machines?$select=disks&$expand=disks'
<Collection xmlns="http://schemas.dmtf.org/cimi/1"
resourceURI="http://schemas.dmtf.org/cimi/1/MachineCollection">
<id>http://localhost:3001/cimi/machines</id>
<count>2</count>
<Machine>
<disks href="http://localhost:3001/cimi/machines/inst0/disks">
<id>http://localhost:3001/cimi/machines/inst0/disks</id>
<count>1</count>
<Disk>
<capacity>891289600</capacity>
</Disk>
</disks>
</Machine>
<Machine>
<disks href="http://localhost:3001/cimi/machines/inst1/disks">
<id>http://localhost:3001/cimi/machines/inst1/disks</id>
<count>1</count>
<Disk>
<capacity>167772160</capacity>
</Disk>
</disks>
</Machine>
<operation rel="add" href="http://localhost:3001/cimi/machines" />
</Collection>
was (Author: lutter):
It took me a while to figure this out: your shell is taking you to the
cleaners, as $select and $expand get replaced with nothing by your shell.
Enclose the URL in single quotes and you get:
curl -H 'Accept: application/xml' -i --user "mockuser:mockpassword"
'http://localhost:3001/cimi/machines?$select=disks&$expand=disks'
<Collection xmlns="http://schemas.dmtf.org/cimi/1"
resourceURI="http://schemas.dmtf.org/cimi/1/MachineCollection">
<id>http://localhost:3001/cimi/machines</id>
<count>2</count>
<Machine>
<disks href="http://localhost:3001/cimi/machines/inst0/disks">
<id>http://localhost:3001/cimi/machines/inst0/disks</id>
<count>1</count>
<Disk>
<capacity>891289600</capacity>
</Disk>
</disks>
</Machine>
<Machine>
<disks href="http://localhost:3001/cimi/machines/inst1/disks">
<id>http://localhost:3001/cimi/machines/inst1/disks</id>
<count>1</count>
<Disk>
<capacity>167772160</capacity>
</Disk>
</disks>
</Machine>
<operation rel="add" href="http://localhost:3001/cimi/machines" />
</Collection>
> Using $select=disks&$expand=disks return 500
> --------------------------------------------
>
> Key: DTACLOUD-432
> URL: https://issues.apache.org/jira/browse/DTACLOUD-432
> Project: DeltaCloud
> Issue Type: Bug
> Reporter: Michal Fojtik
> Assignee: Michal Fojtik
>
> When using this URL:
> http://localhost:3001/cimi/machines?$expand=disks&$select=disks
> I expect that only expanded disks subcollection will appear. However I get
> this:
> error status="500" url="/cimi/machines">
> <kind>backend_error</kind>
> <message>
> <![CDATA[undefined local variable or method `entry_name' for
> #<Class::DiskCollection:0x7fe03934a050> ]]>
> </message>
> <backend driver="mock">
> <code>500</code>
> </backend>
> <backtrace>
> [ Abbreviated trace pass fulltrace=1 as query param to see everything $app =
> /home/mfojtik/code/core/server/lib ] $app/cimi/models/collection.rb:56:in
> `[]' $app/cimi/models/collection.rb:27:in `initialize'
> $app/cimi/models/schema.rb:266:in `new' $app/cimi/models/schema.rb:266:in
> `convert' $app/cimi/models/schema.rb:288:in `convert'
> $app/cimi/models/base.rb:184:in `initialize' ...
> $app/cimi/models/base.rb:183:in `each' $app/cimi/models/base.rb:183:in
> `inject' $app/cimi/models/base.rb:183:in `initialize'
> $app/cimi/models/base.rb:288:in `new' $app/cimi/models/base.rb:288:in
> `filter_attributes' $app/cimi/models/collection.rb:67:in `filter_attributes'
> $app/cimi/models/collection.rb:66:in `map'
> $app/cimi/models/collection.rb:66:in `filter_attributes'
> $app/cimi/models/base.rb:252:in `filter_by'
> $app/cimi/collections/machines.rb:27 ... $app/sinatra/rack_accept.rb:164:in
> `call' ... $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_accept.rb:164:in `call' ...
> $app/sinatra/rack_driver_select.rb:45:in `call'
> $app/sinatra/rack_matrix_params.rb:104:in `call'
> $app/sinatra/rack_etag.rb:41:in `call' $app/sinatra/rack_date.rb:31:in `call'
> $app/sinatra/rack_logger.rb:76:in `call' $app/sinatra/rack_accept.rb:164:in
> `call' ... $app/sinatra/rack_matrix_params.rb:104:in `call' ...
> </backtrace>
> </error>
--
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