Commit baebe8ef by Bach Dániel

firewall: random fix

parent e1b47e06
...@@ -45,7 +45,7 @@ def firewall_api(request): ...@@ -45,7 +45,7 @@ def firewall_api(request):
obj.reason=data["reason"] obj.reason=data["reason"]
obj.snort_message=data["snort_message"] obj.snort_message=data["snort_message"]
obj.save() obj.save()
return HttpResponse(_("OK")); return HttpResponse(unicode(_("OK")));
if not (data["vlan"] == "vm-net" or data["vlan"] == "war"): if not (data["vlan"] == "vm-net" or data["vlan"] == "war"):
raise Exception(_("Only vm-net and war can be used.")) raise Exception(_("Only vm-net and war can be used."))
...@@ -88,4 +88,4 @@ def firewall_api(request): ...@@ -88,4 +88,4 @@ def firewall_api(request):
except: except:
return HttpResponse(_("Something went wrong!\n")); return HttpResponse(_("Something went wrong!\n"));
return HttpResponse(_("OK")); return HttpResponse(unicode(_("OK")));
...@@ -332,7 +332,6 @@ class VmPortAddView(View): ...@@ -332,7 +332,6 @@ class VmPortAddView(View):
raise ValidationError(_("Port number is in a restricted domain (22000 to 24000).")) raise ValidationError(_("Port number is in a restricted domain (22000 to 24000)."))
inst = get_object_or_404(Instance, id=iid, owner=request.user) inst = get_object_or_404(Instance, id=iid, owner=request.user)
inst.firewall_host.add_port(proto=request.POST['proto'], public=public, private=int(request.POST['private'])) inst.firewall_host.add_port(proto=request.POST['proto'], public=public, private=int(request.POST['private']))
reload_firewall_lock()
messages.success(request, _(u"Port %d successfully added.") % public) messages.success(request, _(u"Port %d successfully added.") % public)
except: except:
messages.error(request, _(u"Adding port failed.")) messages.error(request, _(u"Adding port failed."))
...@@ -351,7 +350,6 @@ def vm_port_del(request, iid, proto, public): ...@@ -351,7 +350,6 @@ def vm_port_del(request, iid, proto, public):
inst = get_object_or_404(Instance, id=iid, owner=request.user) inst = get_object_or_404(Instance, id=iid, owner=request.user)
try: try:
inst.firewall_host.del_port(proto=proto, public=public) inst.firewall_host.del_port(proto=proto, public=public)
reload_firewall_lock()
messages.success(request, _(u"Port %d successfully removed.") % public) messages.success(request, _(u"Port %d successfully removed.") % public)
except: except:
messages.error(request, _(u"Removing port failed.")) messages.error(request, _(u"Removing port failed."))
......
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