lib/rubber/recipes/rubber/security_groups.rb in sml-rubber-0.9.9 vs lib/rubber/recipes/rubber/security_groups.rb in sml-rubber-0.9.10

- old
+ new

@@ -43,12 +43,12 @@ def setup_security_groups(host=nil, roles=[]) env = rubber_cfg.environment.bind(roles, host) security_group_defns = env.security_groups if env.auto_security_groups - sghosts = (rubber_cfg.instance.collect{|ic| ic.name } + [host]).uniq.compact - sgroles = (rubber_cfg.instance.all_roles + roles).uniq.compact + sghosts = (rubber_instances.collect{|ic| ic.name } + [host]).uniq.compact + sgroles = (rubber_instances.all_roles + roles).uniq.compact security_group_defns = inject_auto_security_groups(security_group_defns, sghosts, sgroles) sync_security_groups(security_group_defns) else sync_security_groups(security_group_defns) end @@ -65,12 +65,11 @@ end return groups end def isolate_prefix - env = rubber_cfg.environment.bind() - return "#{env.app_name}_#{RUBBER_ENV}_" + return "#{rubber_env.app_name}_#{RUBBER_ENV}_" end def isolate_group_name(group_name) new_name = "#{isolate_prefix}#{group_name}" return new_name @@ -91,23 +90,22 @@ end return renamed end def sync_security_groups(groups) - env = rubber_cfg.environment.bind() return unless groups groups = Rubber::Util::stringify(groups) - groups = isolate_groups(groups) if env.isolate_security_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 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 env.isolate_security_groups && group_name !~ /^#{isolate_prefix}/ + 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}" group = groups[group_name] \ No newline at end of file