vm: Features fixes

clear: dict should not be mutated during interation.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-13 16:40:23 +02:00
parent ba86d6da79
commit 680dbf432c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 4 additions and 2 deletions

View File

@ -102,11 +102,13 @@ class Features(dict):
value = '1' if value else ''
else:
value = str(value)
# TODO: perhaps this shouldn't be fired on unchanged value? or at
# least oldvalue should be provided?
self.vm.fire_event('domain-feature-set', key=key, value=value)
super(Features, self).__setitem__(key, value)
def clear(self):
for key in self:
for key in tuple(self):
del self[key]
def pop(self, _key, _default=None):

View File

@ -301,7 +301,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
A feature was removed.
:param subject: Event emitter (the qube object)
:param event: Event name (``'domain-feature-set'``)
:param event: Event name (``'domain-feature-delete'``)
:param key: feature name
.. event:: domain-tag-add (subject, event, tag)