Skip to content

Commit

Permalink
Merge pull request #293 from StateFarmIns/missing_translation_for_por…
Browse files Browse the repository at this point in the history
…t_range

Update firewalld custom service to translate port ranges with a colon…
  • Loading branch information
ghoneycutt authored May 28, 2020
2 parents 5a59913 + 50b8590 commit 79e4203
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/puppet/type/firewalld_custom_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
return value if value == :unset

if value.is_a?(Hash)
value = Hash[value.map { |k, v| [k, v.to_s] }]
# Handle the legacy format from the module translate : to -
value = Hash[value.map { |k, v| [k, v.to_s.tr(':', '-')] }]
else
port, protocol = value.split('/')

Expand Down
1 change: 1 addition & 0 deletions spec/unit/puppet/type/firewalld_custom_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
'65535/tcp',
'tcp',
{ 'protocol' => 'tcp' },
{ 'port' => '1234:4567', 'protocol' => 'tcp' },
{ 'port' => 1234, 'protocol' => 'tcp' },
{ 'port' => 1234, 'protocol' => 'udp' },
{ 'port' => 1234, 'protocol' => 'sctp' },
Expand Down

0 comments on commit 79e4203

Please sign in to comment.