Commit 30b9fcd7 by Czémán Arnold

firewall: fix add_rule command

parent aa12028e
...@@ -107,16 +107,16 @@ class Command(BaseCommand): ...@@ -107,16 +107,16 @@ class Command(BaseCommand):
rule = Rule(direction=dir, dport=port, proto=proto, action=action, rule = Rule(direction=dir, dport=port, proto=proto, action=action,
vlan=vlan, foreign_network=fnet, owner=owner) vlan=vlan, foreign_network=fnet, owner=owner)
rule.full_clean()
rule.save() rule.save()
def is_exist(self, port, proto, action, dir, owner, vlan, fnet): def is_exist(self, port, proto, action, dir, owner, vlan, fnet):
try: rules = Rule.objects.filter(direction=dir,
Rule.objects.get(direction=dir, dport=port, proto=proto, dport=port,
action=action, vlan=vlan, proto=proto,
foreign_network=fnet, owner=owner) action=action,
except Rule.DoesNotExist: vlan=vlan,
return False foreign_network=fnet,
else: owner=owner)
return True return rules.exists()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment