Skip to content

Commit

Permalink
Downcase all group names to force case-insensitive matching of securi…
Browse files Browse the repository at this point in the history
…ty groups, fixes #86
  • Loading branch information
temujin9 committed Apr 12, 2012
1 parent 2974ad0 commit 94d7c7b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/ironfan/security_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def self.all
def self.get_all
groups_list = Ironfan.fog_connection.security_groups.all
@@all = groups_list.inject(Mash.new) do |hsh, fog_group|
hsh[fog_group.name] = fog_group ; hsh
# AWS security_groups are strangely case sensitive, allowing upper-case but colliding regardless
# of the case. This forces all names to lowercase, and matches against that below.
# See https://github.com/infochimps-labs/ironfan/pull/86 for more details.
hsh[fog_group.name.downcase] = fog_group ; hsh
end
end

Expand All @@ -37,6 +40,7 @@ def get
end

def self.get_or_create(group_name, description)
group_name = group_name.to_s.downcase
# FIXME: the '|| Ironfan.fog' part is probably unnecessary
fog_group = all[group_name] || Ironfan.fog_connection.security_groups.get(group_name)
unless fog_group
Expand Down

0 comments on commit 94d7c7b

Please sign in to comment.