Clean up firewall rules on exit

Change-Id: I70f04366f60670776fa4863e3ede84ffcfdcb454
Closes-Bug: #1436880
This commit is contained in:
Dmitry Tantsur 2015-03-26 16:03:03 +01:00
parent 16cc7323a5
commit aba4268f40
2 changed files with 15 additions and 3 deletions

View File

@ -69,6 +69,15 @@ def _clean_up(chain):
_iptables('-X', chain, ignore=True)
def clean_up():
"""Clean up everything before exiting."""
if not CONF.discoverd.manage_firewall:
return
_clean_up(CHAIN)
_clean_up(NEW_CHAIN)
def update_filters(ironic=None):
"""Update firewall filter rules for introspection.

View File

@ -188,6 +188,9 @@ def main(args=sys.argv[1:]): # pragma: no cover
logging.INFO if debug else logging.ERROR)
init()
try:
app.run(debug=debug,
host=CONF.discoverd.listen_address,
port=CONF.discoverd.listen_port)
finally:
firewall.clean_up()