appmenus: misc API sync with core-admin

- there is no longer vm.is_netvm/is_disposablevm.
- 'domain-create-on-disk' even have no longer 'source_template' argument
This commit is contained in:
Marek Marczykowski-Górecki 2016-08-08 00:43:12 +02:00
parent 19609705fc
commit bf140ae175
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -29,6 +29,7 @@ import dbus
import pkg_resources import pkg_resources
import qubes.ext import qubes.ext
import qubes.vm.dispvm
import qubesimgconverter import qubesimgconverter
@ -125,7 +126,7 @@ class AppmenusExtension(qubes.ext.Extension):
if vm.internal: if vm.internal:
return return
if vm.is_disposablevm(): if isinstance(vm, qubes.vm.dispvm.DispVM):
return return
vm.log.info("Creating appmenus") vm.log.info("Creating appmenus")
@ -255,7 +256,7 @@ class AppmenusExtension(qubes.ext.Extension):
if vm.internal: if vm.internal:
return return
if vm.is_disposablevm(): if isinstance(vm, qubes.vm.dispvm.DispVM):
return return
whitelist = self.whitelist_path(vm) whitelist = self.whitelist_path(vm)
@ -309,7 +310,11 @@ class AppmenusExtension(qubes.ext.Extension):
self.appmenus_create(vm) self.appmenus_create(vm)
@qubes.ext.handler('domain-create-on-disk') @qubes.ext.handler('domain-create-on-disk')
def create_on_disk(self, vm, event, source_template=None): def create_on_disk(self, vm, event):
try:
source_template = vm.template
except AttributeError:
source_template = None
if vm.updateable and source_template is None: if vm.updateable and source_template is None:
os.mkdir(self.templates_dir(vm)) os.mkdir(self.templates_dir(vm))
os.mkdir(self.template_icons_dir(vm)) os.mkdir(self.template_icons_dir(vm))
@ -320,8 +325,6 @@ class AppmenusExtension(qubes.ext.Extension):
self.templates_dir(vm)) self.templates_dir(vm))
source_whitelist_filename = 'vm-' + AppmenusSubdirs.whitelist source_whitelist_filename = 'vm-' + AppmenusSubdirs.whitelist
if vm.is_netvm():
source_whitelist_filename = 'netvm-' + AppmenusSubdirs.whitelist
if source_template and os.path.exists( if source_template and os.path.exists(
os.path.join(source_template.dir_path, source_whitelist_filename)): os.path.join(source_template.dir_path, source_whitelist_filename)):
vm.log.info("Creating default whitelisted apps list: {0}". vm.log.info("Creating default whitelisted apps list: {0}".