From 4edfff228091823afcdc36bd747d8a9005ef493a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantino=20V=C3=A1zquez=20Blanco?= Date: Tue, 6 Oct 2009 13:29:29 +0000 Subject: [PATCH] Fixing bug #159, asking for unknown resource sends garbage to client git-svn-id: http://svn.opennebula.org/one/trunk@814 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/cloud/occi/OCCIServer.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/cloud/occi/OCCIServer.rb b/src/cloud/occi/OCCIServer.rb index d1bb0489be..63ef8d08bf 100755 --- a/src/cloud/occi/OCCIServer.rb +++ b/src/cloud/occi/OCCIServer.rb @@ -381,7 +381,13 @@ end get '/compute/:id' do protected! vm = VirtualMachineOCCI.new(VirtualMachine.build_xml(params[:id]),get_one_client_user(@auth.credentials[0])) - vm.info + + result=vm.info + + if OpenNebula::is_error?(result) + return "Error: "+result.message + end + begin vm.to_occi(CONFIG[:server]) rescue Exception => e @@ -406,7 +412,12 @@ end get '/network/:id' do protected! vn = VirtualNetworkOCCI.new(VirtualNetwork.build_xml(params[:id]),get_one_client_user(@auth.credentials[0])) - vn.info + result=vn.info + + if OpenNebula::is_error?(result) + return "Error: "+result.message + end + begin vn.to_occi() rescue Exception => e @@ -426,9 +437,9 @@ get '/storage/:id' do protected! image=$repoman.get(params[:id]) - image.get_image_info - if image + image.get_image_info + xml_response = "" + image.uuid + "" + "" + image.name + "" + "" + ((image.size/1024)/1024).to_s + "" +