appmenus: register event handlers on QubesVM, not BaseVM

It is critical to call rename-related events in the right order related
to those in QubesVM, because handler at QubesVM renames VM directory.

After "qubes/events: fix event handlers ordering" in qubes-core-admin it
is (again) possible to deterministically order event handler from
extension in relation to those from the class itself. But since ordering
on object class have higher priority (first from base class), those
handlers needs to be attached to the same class.
This commit is contained in:
Marek Marczykowski-Górecki 2016-08-15 23:53:11 +02:00
parent da9205c78a
commit 92c3ba578a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -300,13 +300,13 @@ class AppmenusExtension(qubes.ext.Extension):
return
shutil.rmtree(self.icons_dir(vm))
@qubes.ext.handler('property-pre-set:name')
@qubes.ext.handler('property-pre-set:name', vm=qubes.vm.qubesvm.QubesVM)
def pre_rename(self, vm, event, prop, *args):
if not os.path.exists(vm.dir_path):
return
self.appmenus_remove(vm)
@qubes.ext.handler('property-set:name')
@qubes.ext.handler('property-set:name', vm=qubes.vm.qubesvm.QubesVM)
def post_rename(self, vm, event, prop, *args):
if not os.path.exists(vm.dir_path):
return