Removed unused vm.icon_path property

The property was not used for anything, but caused numerous
problems due to symlinks.

fixes QubesOS/qubes-issues#5934
This commit is contained in:
Marta Marczykowska-Górecka 2020-07-05 20:48:20 +02:00
parent d0f619d3c6
commit bed8e578d7
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
4 changed files with 1 additions and 52 deletions

View File

@ -184,16 +184,12 @@ class TC_00_BackupCompatibility(
os.mkdir(self.fullpath("appvms/test-work"))
self.create_whitelisted_appmenus(self.fullpath(
"appvms/test-work/whitelisted-appmenus.list"))
os.symlink("/usr/share/qubes/icons/green.png",
self.fullpath("appvms/test-work/icon.png"))
self.create_private_img(self.fullpath("appvms/test-work/private.img"))
# StandaloneVM
os.mkdir(self.fullpath("appvms/test-standalonevm"))
self.create_whitelisted_appmenus(self.fullpath(
"appvms/test-standalonevm/whitelisted-appmenus.list"))
os.symlink("/usr/share/qubes/icons/blue.png",
self.fullpath("appvms/test-standalonevm/icon.png"))
self.create_private_img(self.fullpath(
"appvms/test-standalonevm/private.img"))
self.create_sparse(
@ -254,8 +250,6 @@ class TC_00_BackupCompatibility(
self.create_whitelisted_appmenus(self.fullpath(
"vm-templates/test-template-clone/netvm-whitelisted-appmenus"
".list"))
os.symlink("/usr/share/qubes/icons/green.png",
self.fullpath("vm-templates/test-template-clone/icon.png"))
os.mkdir(
self.fullpath("vm-templates/test-template-clone/apps.templates"))
self.create_appmenus(

View File

@ -94,9 +94,7 @@ class TC_00_DispVM(qubes.tests.QubesTestCase):
self.assertEqual(dispvm.auto_cleanup, True)
mock_makedirs.assert_called_once_with(
'/var/lib/qubes/appvms/' + dispvm.name, mode=0o775, exist_ok=True)
mock_symlink.assert_called_once_with(
'/usr/share/icons/hicolor/128x128/devices/appvm-red.png',
'/var/lib/qubes/appvms/{}/icon.png'.format(dispvm.name))
mock_symlink.assert_not_called()
def test_001_from_appvm_reject_not_allowed(self):
with self.assertRaises(qubes.exc.QubesException):

View File

@ -213,10 +213,6 @@ class AdminVM(qubes.vm.BaseVM):
'''
raise qubes.exc.QubesVMError(self, 'Cannot kill Dom0 fake domain!')
@property
def icon_path(self):
pass
@property
def untrusted_qdb(self):
'''QubesDB handle for this domain.'''

View File

@ -808,10 +808,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
self.dir_path_prefix,
self.name)
@property
def icon_path(self):
return os.path.join(self.dir_path, 'icon.png')
@property
def conf_file(self):
return os.path.join(self.dir_path, 'libvirt.xml')
@ -954,17 +950,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
@qubes.events.handler('property-set:label')
def on_property_set_label(self, event, name, newvalue, oldvalue=None):
# pylint: disable=unused-argument
if self.icon_path:
try:
os.remove(self.icon_path)
except OSError:
pass
if hasattr(os, "symlink"):
os.symlink(newvalue.icon_path, self.icon_path)
subprocess.call(['sudo', 'xdg-icon-resource', 'forceupdate'])
else:
shutil.copy(newvalue.icon_path, self.icon_path)
# icon is calculated based on label
self.fire_event('property-reset:icon', name='icon')
@ -1687,15 +1672,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
'creation'.format(self.dir_path))
raise
if os.path.exists(self.icon_path):
os.unlink(self.icon_path)
self.log.info('Creating icon symlink: {} -> {}'.format(
self.icon_path, self.label.icon_path))
if hasattr(os, "symlink"):
os.symlink(self.label.icon_path, self.icon_path)
else:
shutil.copy(self.label.icon_path, self.icon_path)
# fire hooks
yield from self.fire_event_async('domain-create-on-disk')
@ -1754,21 +1730,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
self.storage.verify()
assert self.volumes != {}
if src.icon_path is not None \
and os.path.exists(src.icon_path) \
and self.icon_path is not None:
if os.path.islink(src.icon_path):
icon_path = os.readlink(src.icon_path)
self.log.info(
'Creating icon symlink {} -> {}'.format(
self.icon_path, icon_path))
os.symlink(icon_path, self.icon_path)
else:
self.log.info(
'Copying icon {} -> {}'.format(
src.icon_path, self.icon_path))
shutil.copy(src.icon_path, self.icon_path)
# fire hooks
yield from self.fire_event_async('domain-clone-files', src=src)