diff --git a/qubes/firewall.py b/qubes/firewall.py index c5146759..fed1358b 100644 --- a/qubes/firewall.py +++ b/qubes/firewall.py @@ -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')