From 4893b287515fc85a6d678f4eff8ef79b8b2b6d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 22 Nov 2013 03:56:04 +0100 Subject: [PATCH] appmenus: fix handling template VMs and HVMs Adding separate hook for QubesTemplateVm doesn't work - this refers to the same hook list as in base class. But actually generic hook covers template case without any change. Also do not skip adding appmenus for HVM --- appmenus-scripts/qubes-core-appmenus.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/appmenus-scripts/qubes-core-appmenus.py b/appmenus-scripts/qubes-core-appmenus.py index ed2811a..d2fc76a 100644 --- a/appmenus-scripts/qubes-core-appmenus.py +++ b/appmenus-scripts/qubes-core-appmenus.py @@ -26,7 +26,7 @@ import sys import os.path import shutil -from qubes.qubes import QubesVm,QubesHVm,QubesTemplateVm +from qubes.qubes import QubesVm,QubesHVm from qubes.qubes import QubesException,QubesHost,QubesVmLabels from qubes.qubes import vm_files,system_path,dry_run @@ -45,10 +45,6 @@ def QubesVm_get_attrs_config(self, attrs): 'self.template.appmenus_templates_dir if self.template is not None else None' } return attrs -def QubesTemplateVm_get_attrs_config(self, attrs): - attrs['appmenus_templates_dir'] = { 'eval': 'os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"])' } - return attrs - def QubesVm_appmenus_create(self, verbose=False, source_template = None): if source_template is None: source_template = self.template @@ -97,12 +93,11 @@ def QubesVm_post_rename(self, old_name): def QubesVm_create_on_disk(self, verbose, source_template): - if isinstance(self, QubesHVm): + if isinstance(self, QubesHVm) and source_template is None: if verbose: print >> sys.stderr, "--> Creating appmenus directory: {0}".format(self.appmenus_templates_dir) os.mkdir (self.appmenus_templates_dir) shutil.copy (system_path["appmenu_start_hvm_template"], self.appmenus_templates_dir) - return source_whitelist_filename = 'vm-' + vm_files["appmenus_whitelist"] if self.is_netvm(): @@ -158,5 +153,3 @@ QubesVm.hooks_post_rename.append(QubesVm_post_rename) QubesVm.hooks_create_on_disk.append(QubesVm_create_on_disk) QubesVm.hooks_clone_disk_files.append(QubesVm_clone_disk_files) QubesVm.hooks_remove_from_disk.append(QubesVm_remove_from_disk) - -QubesTemplateVm.hooks_get_attrs_config.append(QubesTemplateVm_get_attrs_config)