You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2013/01/14 14:17:34 UTC

[4/4] git commit: CIMI: Replace save! with save in datamapper

Updated Branches:
  refs/heads/master e7338751b -> 79ba9adae


CIMI: Replace save! with save in datamapper

For unknown reason the 'save!' method does not
work properly when using 'dm-timestamps'.

However there is no reason to use exlamation mark
suffix anyway.


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

Branch: refs/heads/master
Commit: 79ba9adae48b3a0764063956c64aeb82c07b2779
Parents: a456f35
Author: Michal Fojtik <mf...@redhat.com>
Authored: Mon Jan 14 13:48:40 2013 +0100
Committer: Michal fojtik <mf...@redhat.com>
Committed: Mon Jan 14 13:48:40 2013 +0100

----------------------------------------------------------------------
 server/lib/cimi/helpers/database_helper.rb     |    3 ++-
 server/lib/cimi/models/address_template.rb     |    4 ++--
 server/lib/cimi/models/machine_template.rb     |    4 ++--
 server/lib/cimi/models/volume_configuration.rb |    4 ++--
 server/lib/cimi/models/volume_template.rb      |    2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79ba9ada/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 22d20ac..ac6ae4f 100644
--- a/server/lib/cimi/helpers/database_helper.rb
+++ b/server/lib/cimi/helpers/database_helper.rb
@@ -48,6 +48,7 @@ module Deltacloud
 
       def store_attributes_for(model, attrs={})
         return if test_environment? or model.nil? or attrs.empty?
+        return if model.id.nil?
         entity = get_entity(model) || current_db.entities.new(:be_kind => model.to_entity, :be_id => model.id)
 
         entity.description = extract_attribute_value('description', attrs) if attrs.has_key? 'description'
@@ -58,7 +59,7 @@ module Deltacloud
           entity.ent_properties = extract_attribute_value('property', attrs).to_json
         end
 
-        entity.save! && entity
+        entity.save && entity
       end
 
       # In XML serialization the values stored in attrs are arrays, dues to

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79ba9ada/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 c8a4de6..2d81f23 100644
--- a/server/lib/cimi/models/address_template.rb
+++ b/server/lib/cimi/models/address_template.rb
@@ -78,7 +78,7 @@ class CIMI::Model::AddressTemplate < CIMI::Model::Base
       :be_kind => 'address_template',
       :be_id => ''
     )
-    new_template.save!
+    new_template.save
     from_db(new_template, context)
   end
 
@@ -99,7 +99,7 @@ class CIMI::Model::AddressTemplate < CIMI::Model::Base
       :be_kind => 'machine_template',
       :be_id => ''
     )
-    new_template.save!
+    new_template.save
     from_db(new_template, context)
   end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79ba9ada/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 4fb8cd5..eb660d2 100644
--- a/server/lib/cimi/models/machine_template.rb
+++ b/server/lib/cimi/models/machine_template.rb
@@ -70,7 +70,7 @@ class CIMI::Model::MachineTemplate < CIMI::Model::Base
         :be_kind => 'machine_template',
         :be_id => ''
       )
-      new_template.save!
+      new_template.save
       from_db(new_template, context)
     end
 
@@ -85,7 +85,7 @@ class CIMI::Model::MachineTemplate < CIMI::Model::Base
         :be_kind => 'machine_template',
         :be_id => ''
       )
-      new_template.save!
+      new_template.save
       from_db(new_template, context)
     end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79ba9ada/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 4a8373e..b0ba85b 100644
--- a/server/lib/cimi/models/volume_configuration.rb
+++ b/server/lib/cimi/models/volume_configuration.rb
@@ -36,7 +36,7 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
       :be_kind => 'volume_configuration',
       :be_id => ''
     )
-    new_config.save!
+    new_config.save
     from_db(new_config, context)
   end
 
@@ -52,7 +52,7 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
       :be_kind => 'volume_configuration',
       :be_id => ''
     )
-    new_config.save!
+    new_config.save
     from_db(new_config, context)
   end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79ba9ada/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 f40a300..a2b8eb7 100644
--- a/server/lib/cimi/models/volume_template.rb
+++ b/server/lib/cimi/models/volume_template.rb
@@ -67,7 +67,7 @@ class CIMI::Model::VolumeTemplate < CIMI::Model::Base
       :be_kind => 'volume_template',
       :be_id => ''
     )
-    new_template.save!
+    new_template.save
     from_db(new_template, context)
   end