deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [1/2] git commit: CIMI - collections use grab_content_type helper to guess type if not supplied
Date Wed, 05 Dec 2012 01:04:55 GMT
Updated Branches:
  refs/heads/master 2af5edb8c -> 53fee983c


CIMI - collections use grab_content_type helper to guess type if not supplied

Signed-off-by: marios <marios@redhat.com>
TrackedAt: http://tracker-mfojtik.rhcloud.com/patch/3768be55cf8735144715f568b8402dd33906ef37


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/53fee983
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/53fee983
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/53fee983

Branch: refs/heads/master
Commit: 53fee983cfe2559ed2cbf9360caa4b825cc67a27
Parents: d497f6a
Author: marios <marios@redhat.com>
Authored: Tue Dec 4 14:50:41 2012 +0200
Committer: David Lutterkort <lutter@redhat.com>
Committed: Tue Dec 4 16:40:35 2012 -0800

----------------------------------------------------------------------
 server/lib/cimi/collections/addresses.rb         |    2 +-
 server/lib/cimi/collections/credentials.rb       |    2 +-
 server/lib/cimi/collections/machine_templates.rb |    2 +-
 server/lib/cimi/collections/machines.rb          |   10 +++++-----
 server/lib/cimi/collections/network_ports.rb     |    6 +++---
 server/lib/cimi/collections/networks.rb          |    8 ++++----
 6 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/53fee983/server/lib/cimi/collections/addresses.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/addresses.rb b/server/lib/cimi/collections/addresses.rb
index a5a5986..6f016b2 100644
--- a/server/lib/cimi/collections/addresses.rb
+++ b/server/lib/cimi/collections/addresses.rb
@@ -47,7 +47,7 @@ module CIMI::Collections
       operation :create, :with_capability => :create_address do
         description "Create a new Address"
         control do
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             address = CIMI::Model::Address.create(request.body.read, self, :json)
           else
             address = CIMI::Model::Address.create(request.body.read, self, :xml)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/53fee983/server/lib/cimi/collections/credentials.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/credentials.rb b/server/lib/cimi/collections/credentials.rb
index 24c66c0..f2ca059 100644
--- a/server/lib/cimi/collections/credentials.rb
+++ b/server/lib/cimi/collections/credentials.rb
@@ -46,7 +46,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 grab_content_type(request.content_type, request.body) == :json
             new_admin = Credential.create_from_json(request.body.read, self)
           else
             new_admin = Credential.create_from_xml(request.body.read, self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/53fee983/server/lib/cimi/collections/machine_templates.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/machine_templates.rb b/server/lib/cimi/collections/machine_templates.rb
index bda57a0..a90f360 100644
--- a/server/lib/cimi/collections/machine_templates.rb
+++ b/server/lib/cimi/collections/machine_templates.rb
@@ -45,7 +45,7 @@ module CIMI::Collections
       operation :create do
         description "Create new machine template"
         control do
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             new_machine_template = CIMI::Model::MachineTemplate.create_from_json(request.body.read,
self)
           else
             new_machine_template = CIMI::Model::MachineTemplate.create_from_xml(request.body.read,
self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/53fee983/server/lib/cimi/collections/machines.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb
index 20fcfe0..91fbc64 100644
--- a/server/lib/cimi/collections/machines.rb
+++ b/server/lib/cimi/collections/machines.rb
@@ -46,7 +46,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 grab_content_type(request.content_type, request.body) == :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 grab_content_type(request.content_type, request.body) == :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  grab_content_type(request.content_type, request.body) == :json
             action = Action.from_json(request.body.read.gsub("restart", "reboot"))
           else
             action = Action.from_xml(request.body.read.gsub("restart", "reboot"))
@@ -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  grab_content_type(request.content_type, request.body) == :json
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)
@@ -175,7 +175,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  grab_content_type(request.content_type, request.body) == :json
             volume_to_attach, location = MachineVolume.find_to_attach_from_json(request.body.read,
self)
           else
             volume_to_attach, location = MachineVolume.find_to_attach_from_xml(request.body.read,
self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/53fee983/server/lib/cimi/collections/network_ports.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/network_ports.rb b/server/lib/cimi/collections/network_ports.rb
index 1eb71c6..9a009d6 100644
--- a/server/lib/cimi/collections/network_ports.rb
+++ b/server/lib/cimi/collections/network_ports.rb
@@ -47,7 +47,7 @@ module CIMI::Collections
       operation :create, :with_capability => :create_network_port do
         description "Create a new NetworkPort"
         control do
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :json)
           else
             network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :xml)
@@ -73,7 +73,7 @@ module CIMI::Collections
         control do
           network_port = NetworkPort.find(params[:id], self)
           report_error(404) unless network_port
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)
@@ -91,7 +91,7 @@ module CIMI::Collections
         control do
           network_port = NetworkPort.find(params[:id], self)
           report_error(404) unless network_port
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/53fee983/server/lib/cimi/collections/networks.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/networks.rb b/server/lib/cimi/collections/networks.rb
index 002b828..6500c82 100644
--- a/server/lib/cimi/collections/networks.rb
+++ b/server/lib/cimi/collections/networks.rb
@@ -46,7 +46,7 @@ module CIMI::Collections
       operation :create, :with_capability => :create_network do
         description "Create a new Network"
         control do
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             network = Network.create(request.body.read, self, :json)
           else
             network = Network.create(request.body.read, self, :xml)
@@ -72,7 +72,7 @@ module CIMI::Collections
         control do
           network = Network.find(params[:id], self)
           report_error(404) unless network
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)
@@ -90,7 +90,7 @@ module CIMI::Collections
         control do
           network = Network.find(params[:id], self)
           report_error(404) unless network
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)
@@ -108,7 +108,7 @@ module CIMI::Collections
         control do
           network = Network.find(params[:id], self)
           report_error(404) unless network
-          if request.content_type.end_with?("json")
+          if grab_content_type(request.content_type, request.body) == :json
             action = Action.from_json(request.body.read)
           else
             action = Action.from_xml(request.body.read)


Mime
View raw message