Clean up firewall rules on exit
Change-Id: I70f04366f60670776fa4863e3ede84ffcfdcb454 Closes-Bug: #1436880
This commit is contained in:
parent
16cc7323a5
commit
aba4268f40
@ -69,6 +69,15 @@ def _clean_up(chain):
|
|||||||
_iptables('-X', chain, ignore=True)
|
_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):
|
def update_filters(ironic=None):
|
||||||
"""Update firewall filter rules for introspection.
|
"""Update firewall filter rules for introspection.
|
||||||
|
|
||||||
|
@ -188,6 +188,9 @@ def main(args=sys.argv[1:]): # pragma: no cover
|
|||||||
logging.INFO if debug else logging.ERROR)
|
logging.INFO if debug else logging.ERROR)
|
||||||
|
|
||||||
init()
|
init()
|
||||||
|
try:
|
||||||
app.run(debug=debug,
|
app.run(debug=debug,
|
||||||
host=CONF.discoverd.listen_address,
|
host=CONF.discoverd.listen_address,
|
||||||
port=CONF.discoverd.listen_port)
|
port=CONF.discoverd.listen_port)
|
||||||
|
finally:
|
||||||
|
firewall.clean_up()
|
||||||
|
Loading…
Reference in New Issue
Block a user