Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions qubesadmin/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@ def handle(self, subject, event, **kwargs):
except KeyError:
pass

handlers = [h_func for h_name, h_func_set in self.handlers.items()
for h_func in h_func_set
if fnmatch.fnmatch(event, h_name)]

# skip deserializing parameters (which may make further Admin API calls)
# if no handler is registered for the event
if not handlers:
return

# deserialize known attributes
if event.startswith('device-'):
try:
Expand Down Expand Up @@ -292,9 +301,6 @@ def handle(self, subject, event, **kwargs):
except (KeyError, ValueError):
pass

handlers = [h_func for h_name, h_func_set in self.handlers.items()
for h_func in h_func_set
if fnmatch.fnmatch(event, h_name)]
for handler in handlers:
try:
handler(subject, event, **kwargs)
Expand Down