Hello,
The trivial patch below returns status code 404 in case the object is requested by id not found. Currently the latest deltacloud-core returns status code 200 and an empty XML document (when XML is requested), which produces issues on client-side. It would be nice to see this issue resolved in deltacloud.
I'm sure you'll find ways to improve the patch, and hope it is useful.
Thank you, Roman blog: http://it-result.me/
diff --git a/server/server.rb b/server/server.rb index 67590d0..868a485 100644 --- a/server/server.rb +++ b/server/server.rb @@ -55,6 +55,9 @@ end def show(model) @element = driver.send(model, credentials, { :id => params[:id]} ) instance_variable_set("@#{model}", @element) + if @element.nil? + raise Sinatra::NotFound + end respond_to do |format| format.xml { return convert_to_xml(model, @element) } format.html { haml :"#{model.to_s.pluralize}/show" }
On 08/04/10 14:46 +0400, Roman wrote:
Hello,
The trivial patch below returns status code 404 in case the object is requested by id not found. Currently the latest deltacloud-core returns status code 200 and an empty XML document (when XML is requested), which produces issues on client-side. It would be nice to see this issue resolved in deltacloud.
I'm sure you'll find ways to improve the patch, and hope it is useful.
Good catch! Thank you.
diff --git a/server/server.rb b/server/server.rb index 67590d0..868a485 100644 --- a/server/server.rb +++ b/server/server.rb @@ -55,6 +55,9 @@ end def show(model) @element = driver.send(model, credentials, { :id => params[:id]} ) instance_variable_set("@#{model}", @element)
- if @element.nil?
- raise Sinatra::NotFound
- end respond_to do |format| format.xml { return convert_to_xml(model, @element) } format.html { haml :"#{model.to_s.pluralize}/show" }
ACK
deltacloud-devel@lists.fedorahosted.org