Update cookbooks
This commit is contained in:
@@ -10,8 +10,8 @@ module FirewallCookbook
|
||||
elsif p && p.is_a?(Integer)
|
||||
p.to_s
|
||||
elsif p && p.is_a?(Array)
|
||||
p.map! { |o| port_to_s(o) }
|
||||
p.sort.join(',')
|
||||
p_strings = p.map { |o| port_to_s(o) }
|
||||
p_strings.sort.join(',')
|
||||
elsif p && p.is_a?(Range)
|
||||
if platform_family?('windows')
|
||||
"#{p.first}-#{p.last}"
|
||||
@@ -79,10 +79,10 @@ module FirewallCookbook
|
||||
rules.each do |k, v|
|
||||
next unless v == sorted_value
|
||||
contents << if k.start_with?('COMMIT')
|
||||
'COMMIT'
|
||||
else
|
||||
k
|
||||
end
|
||||
'COMMIT'
|
||||
else
|
||||
k
|
||||
end
|
||||
end
|
||||
end
|
||||
"#{contents.join("\n")}\n"
|
||||
|
||||
@@ -42,7 +42,7 @@ module FirewallCookbook
|
||||
msg << "firewall_rule[#{new_resource.name}] was asked to "
|
||||
msg << "#{new_resource.command} a stateful rule using #{new_resource.stateful} "
|
||||
msg << 'but ufw does not support this kind of rule. Consider guarding by platform_family.'
|
||||
fail msg
|
||||
raise msg
|
||||
end
|
||||
|
||||
# if we don't do this, ufw will fail as it does not support protocol numbers, so we'll only allow it to run if specifying icmp/tcp/udp protocol types
|
||||
@@ -51,7 +51,7 @@ module FirewallCookbook
|
||||
msg << "firewall_rule[#{new_resource.name}] was asked to "
|
||||
msg << "#{new_resource.command} a rule using protocol #{new_resource.protocol} "
|
||||
msg << 'but ufw does not support this kind of rule. Consider guarding by platform_family.'
|
||||
fail msg
|
||||
raise msg
|
||||
end
|
||||
|
||||
# some examples:
|
||||
|
||||
@@ -66,7 +66,7 @@ module FirewallCookbook
|
||||
if new_resource.direction.to_sym == :out
|
||||
parameters['localip'] = new_resource.source ? fixup_cidr(new_resource.source) : 'any'
|
||||
parameters['localport'] = new_resource.source_port ? port_to_s(new_resource.source_port) : 'any'
|
||||
parameters['interfacetype'] = new_resource.source_interface ? new_resource.source_interface : 'any'
|
||||
parameters['interfacetype'] = new_resource.interface ? new_resource.interface : 'any'
|
||||
parameters['remoteip'] = new_resource.destination ? fixup_cidr(new_resource.destination) : 'any'
|
||||
parameters['remoteport'] = port_to_s(new_resource.dest_port) ? new_resource.dest_port : 'any'
|
||||
else
|
||||
|
||||
@@ -25,7 +25,7 @@ class Chef
|
||||
return unless new_resource.notify_firewall
|
||||
|
||||
firewall_resource = run_context.resource_collection.find(firewall: new_resource.firewall_name)
|
||||
fail 'could not find a firewall resource' unless firewall_resource
|
||||
raise 'could not find a firewall resource' unless firewall_resource
|
||||
|
||||
new_resource.notifies(:restart, firewall_resource, :delayed)
|
||||
new_resource.updated_by_last_action(true)
|
||||
|
||||
Reference in New Issue
Block a user