qubes/firewall: make xml parameter to Rule optional

QubesOS/qubes-issues#1815
This commit is contained in:
Marek Marczykowski-Górecki 2016-09-19 17:47:42 +02:00
parent cdc97730cd
commit f8dd7e6cb7
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -204,7 +204,12 @@ class Comment(RuleOption):
class Rule(qubes.PropertyHolder):
def __init__(self, xml, **kwargs):
def __init__(self, xml=None, **kwargs):
'''Single firewall rule
:param xml: XML element describing rule, or None
:param kwargs: rule elements
'''
super(Rule, self).__init__(xml, **kwargs)
self.load_properties()
self.events_enabled = True
@ -347,7 +352,7 @@ class Rule(qubes.PropertyHolder):
if expire:
kwargs['expire'] = expire
return cls(None, **kwargs)
return cls(**kwargs)
def __eq__(self, other):
return self.rule == other.rule