deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/7] git commit: CIMI: Improved 'store_attributes_for' to be more smart with properties
Date Thu, 03 Jan 2013 11:05:09 GMT
CIMI: Improved 'store_attributes_for' to be more smart with properties

* In JSON the field is called 'properties', but in XML the XmlSimple parser
  call it 'property'. This patch will learn the store_attributes_for method
  how to deal with this.


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

Branch: refs/heads/master
Commit: de086ca5de4a4d10efeb1da12c9dab201fc7b3f5
Parents: 1e38a10
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Jan 2 12:45:55 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Thu Jan 3 11:06:53 2013 +0100

----------------------------------------------------------------------
 server/lib/cimi/helpers/database_helper.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/de086ca5/server/lib/cimi/helpers/database_helper.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/helpers/database_helper.rb b/server/lib/cimi/helpers/database_helper.rb
index 090f6d8..b581c7b 100644
--- a/server/lib/cimi/helpers/database_helper.rb
+++ b/server/lib/cimi/helpers/database_helper.rb
@@ -44,7 +44,11 @@ module Deltacloud
 
         entity.description = extract_attribute_value('description', attrs) if attrs.has_key?
'description'
         entity.name = extract_attribute_value('name', attrs) if attrs.has_key? 'name'
-        entity.ent_properties = extract_attribute_value('properties', attrs).to_json if attrs.has_key?
'properties'
+        if attrs.has_key? 'properties'
+          entity.ent_properties = extract_attribute_value('properties', attrs).to_json
+        elsif attrs.has_key? 'property'
+          entity.ent_properties = extract_attribute_value('property', attrs).to_json
+        end
 
         entity.save! && entity
       end


Mime
View raw message