deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 1/3] CIMI - replace +json and +xml for expected content types
Date Wed, 07 Nov 2012 08:22:11 GMT
From: marios <marios@redhat.com>

(now just application/json application/xml)

Signed-off-by: marios <marios@redhat.com>
---
 server/lib/cimi/collections/credentials.rb |  2 +-
 server/lib/cimi/collections/machines.rb    | 12 ++++++------
 server/lib/cimi/collections/volumes.rb     |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/server/lib/cimi/collections/credentials.rb b/server/lib/cimi/collections/credentials.rb
index 2fc5c58..529cf0d 100644
--- a/server/lib/cimi/collections/credentials.rb
+++ b/server/lib/cimi/collections/credentials.rb
@@ -47,7 +47,7 @@ module CIMI::Collections
       operation :create, :with_capability => :create_key do
         description "Show specific machine admin"
         control do
-          if request.content_type.end_with?("+json")
+          if request.content_type.end_with?("json")
             new_admin = Credential.create_from_json(request.body.read, self)
           else
             new_admin = Credential.create_from_xml(request.body.read, self)
diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb
index 5390140..d255064 100644
--- a/server/lib/cimi/collections/machines.rb
+++ b/server/lib/cimi/collections/machines.rb
@@ -47,7 +47,7 @@ module CIMI::Collections
       operation :create, :with_capability => :create_instance do
         description "Create a new Machine entity."
         control do
-          if request.content_type.end_with?("+json")
+          if request.content_type.end_with?("json")
             new_machine = Machine.create_from_json(request.body.read, self)
           else
             new_machine = Machine.create_from_xml(request.body.read, self)
@@ -73,7 +73,7 @@ module CIMI::Collections
         param :id,          :string,    :required
         control do
           machine = Machine.find(params[:id], self)
-          if request.content_type.end_with?("+json")
+          if request.content_type.end_with?("json")
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)
@@ -90,7 +90,7 @@ module CIMI::Collections
         param :id,          :string,    :required
         control do
           machine = Machine.find(params[:id], self)
-          if request.content_type.end_with?("+json")
+          if request.content_type.end_with?("json")
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)
@@ -107,7 +107,7 @@ module CIMI::Collections
         param :id,          :string,    :required
         control do
           machine = Machine.find(params[:id], self)
-          if request.content_type.end_with?("+json")
+          if request.content_type.end_with?("json")
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)
@@ -150,7 +150,7 @@ module CIMI::Collections
         description "Attach CIMI Volume(s) to a machine."
         param :id,          :string,    :required
         control do
-          if request.content_type.end_with?("+json")
+          if request.content_type.end_with?("json")
             volumes_to_attach = Volume.find_to_attach_from_json(request.body.read, self)
           else
             volumes_to_attach = Volume.find_to_attach_from_xml(request.body.read, self)
@@ -167,7 +167,7 @@ module CIMI::Collections
         description "Detach CIMI Volume(s) from a machine."
         param :id,          :string,    :required
         control do
-          if request.content_type.end_with?("+json")
+          if request.content_type.end_with?("json")
             volumes_to_detach = Volume.find_to_attach_from_json(request.body.read, self)
           else
             volumes_to_detach = Volume.find_to_attach_from_xml(request.body.read, self)
diff --git a/server/lib/cimi/collections/volumes.rb b/server/lib/cimi/collections/volumes.rb
index 393d19e..7a8d58c 100644
--- a/server/lib/cimi/collections/volumes.rb
+++ b/server/lib/cimi/collections/volumes.rb
@@ -50,8 +50,8 @@ module CIMI::Collections
       operation :create do
         description "Create a new Volume."
         control do
-          content_type = (request.content_type.end_with?("+json") ? :json  : :xml)
-          #((request.content_type.end_with?("+xml")) ? :xml : report_error(415) ) FIXME
+          content_type = (request.content_type.end_with?("json") ? :json  : :xml)
+          #((request.content_type.end_with?("xml")) ? :xml : report_error(415) ) FIXME
           case content_type
           when :json
             new_volume = Volume.create_from_json(request.body.read, self)
-- 
1.7.11.7


Mime
View raw message