Fix bugs found in testing
This commit is contained in:
parent
dc615dae7f
commit
11b9071066
@ -76,14 +76,14 @@ class RuleChoice(RuleOption):
|
|||||||
class Action(RuleChoice):
|
class Action(RuleChoice):
|
||||||
accept = 'accept'
|
accept = 'accept'
|
||||||
drop = 'drop'
|
drop = 'drop'
|
||||||
forward= = 'forward'
|
forward = 'forward'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def rule(self):
|
def rule(self):
|
||||||
return 'action=' + str(self)
|
return 'action=' + str(self)
|
||||||
|
|
||||||
|
|
||||||
class ForwardType(RuleOption):
|
class ForwardType(RuleChoice):
|
||||||
external = 'external'
|
external = 'external'
|
||||||
internal = 'internal'
|
internal = 'internal'
|
||||||
|
|
||||||
@ -310,8 +310,9 @@ class Rule(qubes.PropertyHolder):
|
|||||||
doc='rule action')
|
doc='rule action')
|
||||||
|
|
||||||
forwardtype = qubes.property('forwardtype',
|
forwardtype = qubes.property('forwardtype',
|
||||||
type=Action,
|
type=ForwardType,
|
||||||
order=0,
|
default=None,
|
||||||
|
order=1,
|
||||||
doc='forwarding type (\'internal\' or \'external\')')
|
doc='forwarding type (\'internal\' or \'external\')')
|
||||||
|
|
||||||
proto = qubes.property('proto',
|
proto = qubes.property('proto',
|
||||||
@ -384,17 +385,17 @@ class Rule(qubes.PropertyHolder):
|
|||||||
if newvalue not in ('icmp',):
|
if newvalue not in ('icmp',):
|
||||||
self.icmptype = qubes.property.DEFAULT
|
self.icmptype = qubes.property.DEFAULT
|
||||||
|
|
||||||
@qubes.events.handler('property-pre-set:forwardtype')
|
@qubes.events.handler('property-set:forwardtype')
|
||||||
def on_set_forwardtype(self, event, name, newvalue, oldvalue=None):
|
def on_set_forwardtype(self, event, name, newvalue, oldvalue=None):
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
if self.action not 'forward':
|
if self.action is not 'forward':
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'forwardtype valid only for forward action')
|
'forwardtype valid only for forward action')
|
||||||
|
|
||||||
@qubes.events.handler('property-pre-set:srcports')
|
@qubes.events.handler('property-set:srcports')
|
||||||
def on_set_srcports(self, event, name, newvalue, oldvalue=None):
|
def on_set_srcports(self, event, name, newvalue, oldvalue=None):
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
if self.action not 'forward':
|
if self.action is not 'forward':
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'srcports valid only for forward action')
|
'srcports valid only for forward action')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user