You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2010/12/09 15:40:34 UTC

[PATCH core 5/6] Fixed server.rb to produce output for Hardware profile in same way as we do with other collections

From: Michal Fojtik <mf...@redhat.com>

---
 server/server.rb |   24 +++---------------------
 1 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/server/server.rb b/server/server.rb
index 9585f9b..d873aba 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -318,7 +318,7 @@ END
         format.xml do
           response.status = 201  # Created
           response['Location'] = instance_url(instance.id)
-          @instance = instance
+          @instance, @element = instance, instance
           haml :"instances/show"
         end
         format.html do
@@ -371,32 +371,14 @@ END
     with_capability :hardware_profiles
     param :id,          :string
     param :architecture,  :string,  :optional,  [ 'i386', 'x86_64' ]
-    control do
-        @profiles = driver.hardware_profiles(credentials, params)
-        respond_to do |format|
-          format.xml  { haml :'hardware_profiles/index' }
-          format.html  { haml :'hardware_profiles/index' }
-          format.json { convert_to_json(:hardware_profile, @profiles) }
-        end
-    end
+    control { filter_all(:hardware_profiles) }
   end
 
   operation :show do
     description "Show specific hardware profile."
     with_capability :hardware_profile
     param :id,          :string,    :required
-    control do
-      @profile =  driver.hardware_profile(credentials, params[:id])
-      if @profile
-        respond_to do |format|
-          format.xml { haml :'hardware_profiles/show', :layout => false }
-          format.html { haml :'hardware_profiles/show' }
-          format.json { convert_to_json(:hardware_profile, @profile) }
-        end
-      else
-        report_error(404, 'not_found')
-      end
-    end
+    control { show ( :hardware_profile ) }
   end
 
 end
-- 
1.7.3.2