lib/rubber/recipes/rubber/security_groups.rb in sml-rubber-0.9.11 vs lib/rubber/recipes/rubber/security_groups.rb in sml-rubber-0.9.13
- old
+ new
@@ -96,21 +96,21 @@
groups = Rubber::Util::stringify(groups)
groups = isolate_groups(groups) if rubber_env.isolate_security_groups
group_keys = groups.keys.clone()
- # For each group that does already exist in ec2
+ # For each group that does already exist in cloud
cloud_groups = cloud.describe_security_groups()
cloud_groups.each do |cloud_group|
group_name = cloud_group[:name]
# skip those groups that don't belong to this project/env
next if rubber_env.isolate_security_groups && group_name !~ /^#{isolate_prefix}/
if group_keys.delete(group_name)
# sync rules
- logger.debug "Security Group already in ec2, syncing rules: #{group_name}"
+ logger.debug "Security Group already in cloud, syncing rules: #{group_name}"
group = groups[group_name]
rules = group['rules'].clone
rule_maps = []
# first collect the rule maps from the request (group/user pairs are duplicated for tcp/udp/icmp,
@@ -131,12 +131,12 @@
rule_maps.each do |rule_map|
if rules.delete(rule_map)
# rules match, don't need to do anything
# logger.debug "Rule in sync: #{rule_map.inspect}"
else
- # rules don't match, remove them from ec2 and re-add below
- answer = Capistrano::CLI.ui.ask("Rule '#{rule_map.inspect}' exists in ec2, but not locally, remove from ec2? [y/N]?: ")
+ # rules don't match, remove them from cloud and re-add below
+ answer = Capistrano::CLI.ui.ask("Rule '#{rule_map.inspect}' exists in cloud, but not locally, remove from cloud? [y/N]?: ")
rule_map = Rubber::Util::symbolize_keys(rule_map)
if rule_map[:source_group_name]
cloud.remove_security_group_rule(group_name, nil, nil, nil, {:name => rule_map[:source_group_name], :account => rule_map[:source_group_account]})
else
rule_map[:source_ips].each do |source_ip|
@@ -158,15 +158,15 @@
end if rule_map[:source_ips]
end
end
else
# delete group
- answer = Capistrano::CLI.ui.ask("Security group '#{group_name}' exists in ec2 but not locally, remove from ec2? [y/N]: ")
+ answer = Capistrano::CLI.ui.ask("Security group '#{group_name}' exists in cloud but not locally, remove from cloud? [y/N]: ")
cloud.destroy_security_group(group_name) if answer =~ /^y/
end
end
- # For each group that didnt already exist in ec2
+ # For each group that didnt already exist in cloud
group_keys.each do |group_name|
group = groups[group_name]
logger.debug "Creating new security group: #{group_name}"
# create each group
cloud.create_security_group(group_name, group['description'])
\ No newline at end of file