Commit f6861f2b by Bach Dániel

vm: raise SuspiciousOperation instead of PermissionDenied

parent bef94b77
...@@ -27,7 +27,7 @@ from tarfile import TarFile, TarInfo ...@@ -27,7 +27,7 @@ from tarfile import TarFile, TarInfo
import time import time
from urlparse import urlsplit from urlparse import urlsplit
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _, ugettext_noop from django.utils.translation import ugettext_lazy as _, ugettext_noop
from django.conf import settings from django.conf import settings
...@@ -617,7 +617,7 @@ class RemovePortOperation(InstanceOperation): ...@@ -617,7 +617,7 @@ class RemovePortOperation(InstanceOperation):
def _operation(self, activity, rule): def _operation(self, activity, rule):
interface = rule.host.interface_set.get() interface = rule.host.interface_set.get()
if interface.instance != self.instance: if interface.instance != self.instance:
raise PermissionDenied() raise SuspiciousOperation()
activity.readable_name = create_readable( activity.readable_name = create_readable(
ugettext_noop("close %(proto)s/%(port)d on %(host)s"), ugettext_noop("close %(proto)s/%(port)d on %(host)s"),
proto=rule.proto, port=rule.dport, host=rule.host) proto=rule.proto, port=rule.dport, host=rule.host)
...@@ -635,7 +635,7 @@ class AddPortOperation(InstanceOperation): ...@@ -635,7 +635,7 @@ class AddPortOperation(InstanceOperation):
def _operation(self, activity, host, proto, port): def _operation(self, activity, host, proto, port):
if host.interface_set.get().instance != self.instance: if host.interface_set.get().instance != self.instance:
raise PermissionDenied() raise SuspiciousOperation()
host.add_port(proto, private=port) host.add_port(proto, private=port)
activity.readable_name = create_readable( activity.readable_name = create_readable(
ugettext_noop("open %(proto)s/%(port)d on %(host)s"), ugettext_noop("open %(proto)s/%(port)d on %(host)s"),
......
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