incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sang-min.p...@eucalyptus.com
Subject [PATCH 1/2] bug fix in ec2::firewall_rule_id
Date Sun, 10 Jul 2011 17:28:29 GMT
From: Sang-Min Park <spark@eucalyptus.com>

---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 53f95b6..a21ba34 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -809,15 +809,15 @@ module Deltacloud
         #generate uid from firewall rule parameters (amazon doesn't do this for us
         def firewall_rule_id(user_id, protocol, from_port, to_port, sources)
           sources_string = ""
-          sources.each do |source|
-            sources_string<<"@"
-            source.each_pair do |key,value|
-              sources_string<< "#{value},"
+          sources.each do |source| 
+	    if source[:type].to_s == "group"
+	       sources_string << "@#{source[:type]},#{source[:owner]},#{source[:name]},"
+            else
+	       sources_string << "@#{source[:type]},#{source[:family]},#{source[:address]},#{source[:prefix]},"
             end
-            sources_string.chomp!(",")
           end
          #sources_string is @group,297467797945,test@address,ipv4,10.1.1.1,24 etc
-         id_string = "#{user_id}~#{protocol}~#{from_port}~#{to_port}~#{sources_string}"
+         id_string = "#{user_id}~#{protocol}~#{from_port}~#{to_port}~#{sources_string.slice(0,sources_string.length-1)}"
         end
 
         #extract params from uid
-- 
1.7.4.1


Mime
View raw message