Pass 'top' to remove_rule so that rule matching succeeds

When deleting a vpn-site-connection, deleting the nat rule would
fail because it was created with top=True, but top defaults to
'false' in remove_rule and was not being passed. This caused the
rule matching to fail and the rule to not be deleted.

Change-Id: I51012a783314c97e85b31fc8a73be4cbb8ee7dc5
Closes-Bug: #1331839
This commit is contained in:
Terry Wilson 2014-06-17 22:32:56 -05:00
parent c4181a370f
commit 407fa6bc46
2 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,7 @@ class VPNAgent(l3_agent.L3NATAgentWithStateReport):
if not router_info:
return
router_info.iptables_manager.ipv4['nat'].remove_rule(
chain, rule)
chain, rule, top=top)
def iptables_apply(self, router_id):
"""Apply IPtables.

View File

@ -127,9 +127,9 @@ class TestVPNAgent(base.BaseTestCase):
iptables = mock.Mock()
ri.iptables_manager.ipv4['nat'] = iptables
self.agent.router_info = {router_id: ri}
self.agent.remove_nat_rule(router_id, 'fake_chain', 'fake_rule')
self.agent.remove_nat_rule(router_id, 'fake_chain', 'fake_rule', True)
iptables.remove_rule.assert_called_once_with(
'fake_chain', 'fake_rule')
'fake_chain', 'fake_rule', top=True)
def test_remove_rule_with_no_router(self):
self.agent.router_info = {}