events: ignore events from non-existing domains

It may happen that when client handle the event, domain no longer
exists. This is for example common for DispVMs, which get removed just
after shutdown.
This will cause some events to be dropped, but one can enable blind
mode, to get them anyway (because it will not cause KeyError, even if
domain is already removed).

QubesOS/qubes-issues#3100
This commit is contained in:
Marek Marczykowski-Górecki 2017-09-20 20:19:38 +02:00
parent b28ddb6621
commit 0a06ad9152
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -191,7 +191,10 @@ class EventsDispatcher(object):
if subject: if subject:
if event in ['property-set:name']: if event in ['property-set:name']:
self.app.domains.clear_cache() self.app.domains.clear_cache()
try:
subject = self.app.domains[subject] subject = self.app.domains[subject]
except KeyError:
return
else: else:
# handle cache refreshing on best-effort basis # handle cache refreshing on best-effort basis
if event in ['domain-add', 'domain-delete']: if event in ['domain-add', 'domain-delete']: