Skip to content

Commit

Permalink
Merge pull request #204 from georgkoester/fix188
Browse files Browse the repository at this point in the history
Fix #188: -f in comment leads to puppet resource firewall failing.
  • Loading branch information
kbarber committed Jun 10, 2013
2 parents 900ef11 + 1057798 commit 972310d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/firewall/iptables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def self.rule_to_hash(line, table, counter)
if bool == :isfragment then
# only replace those -f that are not followed by an l to
# distinguish between -f and the '-f' inside of --tcp-flags.
values = values.sub(/-f(?=[^l])/, '-f true')
values = values.sub(/-f(?!l)(?=.*--comment)/, '-f true')
end
end

Expand Down
12 changes: 11 additions & 1 deletion spec/fixtures/iptables/conversion_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,10 @@
},
},
'isfragment_option' => {
:line => '-A INPUT -f -j ACCEPT',
:line => '-A INPUT -f -m comment --comment "010 a-f comment with dashf" -j ACCEPT',
:table => 'filter',
:params => {
:name => '010 a-f comment with dashf',
:action => 'accept',
:isfragment => true,
},
Expand Down Expand Up @@ -724,4 +725,13 @@
},
:args => ['-t', :filter, '-p', :all, '-f', '-m', 'comment', '--comment', '050 isfragment option', '-j', 'ACCEPT'],
},
'isfragment_option not changing -f in comment' => {
:params => {
:name => '050 testcomment-with-fdashf',
:table => 'filter',
:proto => :all,
:action => 'accept',
},
:args => ['-t', :filter, '-p', :all, '-m', 'comment', '--comment', '050 testcomment-with-fdashf', '-j', 'ACCEPT'],
},
}

0 comments on commit 972310d

Please sign in to comment.