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