deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: CIMI - minor tidy up/nits in parsing of database models
Date Fri, 22 Feb 2013 16:31:25 GMT
Updated Branches:
  refs/heads/master 83d45c5ea -> a5953e975


CIMI - minor tidy up/nits in parsing of database models

(related to DTACLOUD-448)


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

Branch: refs/heads/master
Commit: a5953e975f2fc65aefb43f7834ad0b1a5a4455e1
Parents: 83d45c5
Author: marios <marios@redhat.com>
Authored: Wed Feb 20 16:11:43 2013 +0200
Committer: marios <marios@redhat.com>
Committed: Fri Feb 22 18:27:33 2013 +0200

----------------------------------------------------------------------
 server/lib/cimi/models/volume_configuration.rb |    4 ++--
 server/lib/cimi/models/volume_template.rb      |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a5953e97/server/lib/cimi/models/volume_configuration.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_configuration.rb b/server/lib/cimi/models/volume_configuration.rb
index 031ec44..10ce146 100644
--- a/server/lib/cimi/models/volume_configuration.rb
+++ b/server/lib/cimi/models/volume_configuration.rb
@@ -32,7 +32,7 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
       :description => json['description'],
       :format => json['format'],
       :capacity => json['capacity'],
-      :ent_properties => json['properties'] ? json['properties'].to_json : {}
+      :ent_properties => (json['properties'] || {}).to_json
     )
     from_db(new_config, context)
   end
@@ -45,7 +45,7 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
       :description => xml['description'].first,
       :format => xml['format'].first,
       :capacity => xml['capacity'].first,
-      :ent_properties => xml['property'] ? JSON::dump(xml['property'].inject({}) { |r,
p| r[p['key']]=p['content']; r }) : {}
+      :ent_properties =>  JSON::dump((xml['property'] || {}).inject({}){ |r, p| r[p['key']]=p['content'];
r })
     )
     from_db(new_config, context)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a5953e97/server/lib/cimi/models/volume_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_template.rb b/server/lib/cimi/models/volume_template.rb
index 41d8b92..c00ffc8 100644
--- a/server/lib/cimi/models/volume_template.rb
+++ b/server/lib/cimi/models/volume_template.rb
@@ -56,7 +56,7 @@ class CIMI::Model::VolumeTemplate < CIMI::Model::Base
       :description => input['description'],
       :volume_config => input['volumeConfig']['href'],
       :volume_image => vol_image,
-      :ent_properties => input['property'] ? JSON::dump(input['property'].inject({}) {
|r, p| r[p['key']]=p['content']; r }) : {}
+      :ent_properties => type == :xml ? JSON::dump((xml['property'] || {}).inject({}){
|r, p| r[p['key']]=p['content']; r })  : (json['properties'] || {}).to_json
     )
     from_db(new_template, context)
   end


Mime
View raw message