deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 3/3] Core: Raise error if the collection is already registred in Rabbit
Date Thu, 21 Feb 2013 12:43:57 GMT
From: Michal Fojtik <mfojtik@redhat.com>

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

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/cimi/collections.rb       | 1 +
 server/lib/deltacloud/collections.rb | 3 +++
 2 files changed, 4 insertions(+)

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
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
-- 
1.8.1.2


Mime
View raw message