1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #2345 from alphagov/fixing_bugs_in_firewall_configuration

Fixing bugs in edgegate service configuration
This commit is contained in:
Nick Osborn 2013-10-31 08:35:10 -07:00
commit 64c1458099

View file

@ -28,7 +28,7 @@ module Fog
lb_config[:Pool].each do |pool|
xml.Pool {
xml.Name pool[:Name]
xml.Description pool[:Description] if pool.key?(:Description)
pool[:ServicePort].each do |service_port|
xml.ServicePort {
xml.IsEnabled service_port[:IsEnabled]
@ -38,6 +38,7 @@ module Fog
xml.HealthCheckPort service_port[:HealthCheckPort]
xml.HealthCheck {
xml.Mode service_port[:HealthCheck][:Mode]
xml.Uri service_port[:HealthCheck][:Uri]
xml.HealthThreshold service_port[:HealthCheck][:HealthThreshold]
xml.UnhealthThreshold service_port[:HealthCheck][:UnhealthThreshold]
xml.Interval service_port[:HealthCheck][:Interval]
@ -128,21 +129,22 @@ module Fog
xml.Id rule[:Id]
xml.IsEnabled rule[:IsEnabled] if rule.key?(:IsEnabled)
xml.MatchOnTranslate rule[:MatchOnTranslate] if rule.key?(:MatchOnTranslate)
xml.Description rule[:Description]
xml.Policy rule[:Policy]
xml.Description rule[:Description] if rule.key?(:Description)
xml.Policy rule[:Policy] if rule.key?(:Policy)
xml.Protocols {
rule[:Protocols].each do |protocol, is_enabled|
xml.send(protocol.to_s.capitalize, is_enabled)
rule[:Protocols].each do |key, value|
xml.send(key.to_s.capitalize, value)
end
}
xml.IcmpSubType "any" if (rule[:Protocols].include?(:Icmp) && rule[:Protocols][:Icmp] == true )
xml.Port rule[:Port] == "Any" ? "-1" : rule[:Port]
xml.IcmpSubType rule[:IcmpSubType] if rule.key?(:IcmpSubType)
xml.Port rule[:Port] if rule.key?(:Port)
xml.DestinationPortRange rule[:DestinationPortRange]
xml.DestinationIp rule[:DestinationIp]
xml.SourcePort rule[:SourcePort] == "Any" ? "-1" : rule[:SourcePort]
xml.SourcePort rule[:SourcePort] if rule.key?(:SourcePort)
xml.SourcePortRange rule[:SourcePortRange]
xml.SourceIp rule[:SourceIp]
xml.Direction rule[:Direction] if rule.key?(:Direction) #Firewall rule direction is allowed only in backward compatibility mode.
xml.EnableLogging rule[:EnableLogging] if rule.key?(:EnableLogging)
}