Skip to content

Commit

Permalink
refs #11800, Fix edit SecurityGroup method: do not remove dashes from…
Browse files Browse the repository at this point in the history
… a group owner unless it is in format of '0000-0000-0000'
  • Loading branch information
konstantin committed Jan 31, 2012
1 parent 8317c98 commit 84c24ae
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/ec2/right_ec2_security_groups.rb
Expand Up @@ -371,10 +371,15 @@ def edit_security_group(action, group_name, params)
when :revoke, :remove then action = "RevokeSecurityGroupIngress"
else raise "Unknown action #{action.inspect}!"
end
hash['GroupName'] = group_name
hash['SourceSecurityGroupName'] = params[:source_group] unless params[:source_group].right_blank?
hash['SourceSecurityGroupOwnerId'] = params[:source_group_owner].to_s.gsub(/-/,'') unless params[:source_group_owner].right_blank?
hash['IpProtocol'] = params[:protocol] unless params[:protocol].right_blank?
hash['GroupName'] = group_name
hash['SourceSecurityGroupName'] = params[:source_group] unless params[:source_group].right_blank?
hash['IpProtocol'] = params[:protocol] unless params[:protocol].right_blank?
unless params[:source_group_owner].right_blank?
# Do remove dashes only if the source owner is in format of "7011-0219-8268"
source_group_owner = params[:source_group_owner].to_s
source_group_owner.gsub!(/-/,'') if source_group_owner[/^\d{4}-\d{4}-\d{4}$/]
hash['SourceSecurityGroupOwnerId'] = source_group_owner
end
unless params[:port].right_blank?
hash['FromPort'] = params[:port]
hash['ToPort'] = params[:port]
Expand Down

0 comments on commit 84c24ae

Please sign in to comment.