deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: CIMI bug - create CIMI db resource with no properties - Fix for DTACLOUD-448
Date Tue, 05 Feb 2013 16:31:59 GMT
Updated Branches:
  refs/heads/master 5f168e089 -> 62eeceb61


CIMI bug - create CIMI db resource with no properties - Fix for DTACLOUD-448

https://issues.apache.org/jira/browse/DTACLOUD-448


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

Branch: refs/heads/master
Commit: 62eeceb6198a9e2dc8ceeca1099b30169b7b0d86
Parents: 5f168e0
Author: marios <marios@redhat.com>
Authored: Thu Jan 31 15:05:06 2013 +0200
Committer: marios <marios@redhat.com>
Committed: Tue Feb 5 18:31:41 2013 +0200

----------------------------------------------------------------------
 server/lib/cimi/models/address_template.rb     |    6 +++---
 server/lib/cimi/models/machine_template.rb     |    6 +++---
 server/lib/cimi/models/volume_configuration.rb |    6 +++---
 server/lib/cimi/models/volume_template.rb      |    4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/62eeceb6/server/lib/cimi/models/address_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/address_template.rb b/server/lib/cimi/models/address_template.rb
index d081567..eea4385 100644
--- a/server/lib/cimi/models/address_template.rb
+++ b/server/lib/cimi/models/address_template.rb
@@ -67,7 +67,7 @@ class CIMI::Model::AddressTemplate < CIMI::Model::Base
       :dns => json['dns'],
       :protocol => json['protocol'],
       :mask => json['mask'],
-      :ent_properties => json['properties'].to_json
+      :ent_properties => json['properties'] ? json['properties'].to_json : {}
     )
     from_db(new_template, context)
   end
@@ -85,7 +85,7 @@ class CIMI::Model::AddressTemplate < CIMI::Model::Base
       :dns => xml['dns'].first,
       :protocol => xml['protocol'].nil? ? nil : xml['protocol'].first,
       :mask => xml['mask'].first,
-      :ent_properties => JSON::dump(xml['property'].inject({}) { |r, p| r[p['key']]=p['content'];
r })
+      :ent_properties => xml['property'] ? JSON::dump(xml['property'].inject({}) { |r,
p| r[p['key']]=p['content']; r }) : {}
     )
     from_db(new_template, context)
   end
@@ -108,7 +108,7 @@ class CIMI::Model::AddressTemplate < CIMI::Model::Base
       :dns => model.dns,
       :protocol => model.protocol,
       :mask => model.mask,
-      :property => JSON::parse(model.ent_properties),
+      :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
       :operations => [
         { :href => context.destroy_address_template_url(model.id), :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
}
       ]

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/62eeceb6/server/lib/cimi/models/machine_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_template.rb b/server/lib/cimi/models/machine_template.rb
index 32d2c13..5ba9b3e 100644
--- a/server/lib/cimi/models/machine_template.rb
+++ b/server/lib/cimi/models/machine_template.rb
@@ -59,7 +59,7 @@ class CIMI::Model::MachineTemplate < CIMI::Model::Base
         :description => json['description'],
         :machine_config => json['machineConfig']['href'],
         :machine_image => json['machineImage']['href'],
-        :ent_properties => json['properties'].to_json
+        :ent_properties => json['properties'] ? json['properties'].to_json : {}
       )
       from_db(new_template, context)
     end
@@ -71,7 +71,7 @@ class CIMI::Model::MachineTemplate < CIMI::Model::Base
         :description => xml['description'].first,
         :machine_config => xml['machineConfig'].first['href'],
         :machine_image => xml['machineImage'].first['href'],
-        :ent_properties => JSON::dump(xml['property'].inject({}) { |r, p| r[p['key']]=p['content'];
r })
+        :ent_properties => xml['property'] ? JSON::dump(xml['property'].inject({}) { |r,
p| r[p['key']]=p['content']; r }) : {}
       )
       from_db(new_template, context)
     end
@@ -89,7 +89,7 @@ class CIMI::Model::MachineTemplate < CIMI::Model::Base
         :description => model.description,
         :machine_config => { :href => model.machine_config },
         :machine_image => { :href => model.machine_image },
-        :property => JSON::parse(model.ent_properties),
+        :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
         :created => Time.parse(model.created_at.to_s).xmlschema,
         :operations => [
           { :href => context.destroy_machine_template_url(model.id), :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/62eeceb6/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 9f15635..031ec44 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'].to_json
+      :ent_properties => json['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 => JSON::dump(xml['property'].inject({}) { |r, p| r[p['key']]=p['content'];
r })
+      :ent_properties => xml['property'] ? JSON::dump(xml['property'].inject({}) { |r,
p| r[p['key']]=p['content']; r }) : {}
     )
     from_db(new_config, context)
   end
@@ -81,7 +81,7 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
       :description => model.description,
       :format => model.format,
       :capacity => context.to_kibibyte(model.capacity, "GB"),
-      :property => JSON::parse(model.ent_properties),
+      :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
       :operations => [
         { :href => context.destroy_volume_configuration_url(model.id), :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
}
       ]

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/62eeceb6/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 3a98128..41d8b92 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 => JSON::dump(input['property'].inject({}) { |r, p| r[p['key']]=p['content'];
r })
+      :ent_properties => input['property'] ? JSON::dump(input['property'].inject({}) {
|r, p| r[p['key']]=p['content']; r }) : {}
     )
     from_db(new_template, context)
   end
@@ -74,7 +74,7 @@ private
       :description => model.description,
       :volume_config => {:href => model.volume_config},
       :volume_image => {:href => model.volume_image},
-      :property => JSON::parse(model.ent_properties),
+      :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
       :operations => [
         { :href => context.destroy_volume_template_url(model.id), :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
}
       ]


Mime
View raw message