[trigger] Bugfix pour que le tout marche bien ensemble.

This commit is contained in:
Pierre-Elliott Bécue 2014-06-15 00:54:03 +02:00
parent f41ab72706
commit 4e90bd023b
3 changed files with 17 additions and 15 deletions

View file

@ -52,13 +52,13 @@ def firewall(body=()):
def mac_ip(body):
host_fw = firewall4.firewall()
if body and isinstance(body, dict):
for (mac, ip) in body.get("add", ()):
for (mac, ip) in body.get("add", []):
logger.info("Adding mac_ip %s,%s", mac, ip)
host_fw.mac_ip_append(mac, ip)
for (mac, ip) in body.get("delete", ()):
for (mac, ip) in body.get("delete", []):
logger.info("Removing mac_ip %s,%s", mac, ip)
host_fw.mac_ip_remove(mac, ip)
for (rmac, rip, mac, ip) in body.get("update", ()):
for (rmac, rip, mac, ip) in body.get("update", []):
logger.info("Updating mac_ip %s,%s with %s,%s", rmac, rip, mac, ip)
host_fw.mac_ip_remove(rmac, rip)
host_fw.mac_ip_append(mac, ip)