deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [3/5] git commit: Core: Raise error if the collection is already registred in Rabbit
Date Thu, 21 Feb 2013 13:51:01 GMT
Core: Raise error if the collection is already registred in Rabbit

This patch will make sure you don't have two duplicate collections
registred to Rabbit both for DC and CIMI.


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

Branch: refs/heads/master
Commit: 19babd48ee932515389b2324fe8f6e27ce381154
Parents: 5dacd89
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Feb 21 13:41:40 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Thu Feb 21 13:41:40 2013 +0100

----------------------------------------------------------------------
 server/lib/cimi/collections.rb       |    1 +
 server/lib/deltacloud/collections.rb |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/19babd48/server/lib/cimi/collections.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections.rb b/server/lib/cimi/collections.rb
index 67527fb..e0a93b5 100644
--- a/server/lib/cimi/collections.rb
+++ b/server/lib/cimi/collections.rb
@@ -44,6 +44,7 @@ module CIMI
       cimi_modules << cimi_module_class
       unless cimi_module_class.collections.nil?
         cimi_module_class.collections.each do |c|
+          raise "ERROR: CIMI collection #{c} already registred" if CIMI.collections.include?
c
           CIMI.collections << c
         end
       else

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/19babd48/server/lib/deltacloud/collections.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/collections.rb b/server/lib/deltacloud/collections.rb
index df42cf1..d3517b8 100644
--- a/server/lib/deltacloud/collections.rb
+++ b/server/lib/deltacloud/collections.rb
@@ -43,6 +43,9 @@ module Deltacloud
       deltacloud_module_class = Deltacloud::Collections.const_get(base_collection_name.camelize)
       deltacloud_modules << deltacloud_module_class
       deltacloud_module_class.collections.each do |c|
+        if Deltacloud.collections.include? c
+          raise "ERROR: Deltacloud collection #{c} already registred"
+        end
         Deltacloud.collections << c
       end unless deltacloud_module_class.collections.nil?
     end


Mime
View raw message