From c87820fba8798e1e4079e06028b2367a1463467b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 2 Oct 2017 21:09:43 +0200 Subject: [PATCH] Drop individual VM classes as python types completely Since those are unused now, remove them from the source, so it is easier to debug the code (avoid never matching isinstance(...)). --- qubesadmin/app.py | 14 +++----------- qubesadmin/vm/__init__.py | 21 --------------------- setup.py | 7 ------- 3 files changed, 3 insertions(+), 39 deletions(-) diff --git a/qubesadmin/app.py b/qubesadmin/app.py index 4f03824..d374d2c 100644 --- a/qubesadmin/app.py +++ b/qubesadmin/app.py @@ -38,7 +38,6 @@ import qubesadmin.vm import qubesadmin.config BUF_SIZE = 4096 -VM_ENTRY_POINT = 'qubesadmin.vm' class VMCollection(object): '''Collection of VMs objects''' @@ -220,20 +219,13 @@ class QubesBase(qubesadmin.base.PropertyHolder): def get_vm_class(clsname): '''Find the class for a domain. - Classes are registered as setuptools' entry points in ``qubes.vm`` - group. Any package may supply their own classes. + Compatibility function, client tools use str to identify domain classes. :param str clsname: name of the class - :return type: class + :return str: class ''' - try: - return qubesadmin.utils.get_entry_point_one( - VM_ENTRY_POINT, clsname) - except KeyError: - raise qubesadmin.exc.QubesException( - 'no such VM class: {!r}'.format(clsname)) - # don't catch TypeError + return clsname def add_new_vm(self, cls, name, label, template=None, pool=None, pools=None): diff --git a/qubesadmin/vm/__init__.py b/qubesadmin/vm/__init__.py index a7edc7d..473b7b7 100644 --- a/qubesadmin/vm/__init__.py +++ b/qubesadmin/vm/__init__.py @@ -339,27 +339,6 @@ class QubesVM(qubesadmin.base.PropertyHolder): self._klass = super(QubesVM, self).klass return self._klass -# pylint: disable=abstract-method -class AdminVM(QubesVM): - '''Dom0''' - pass - - -class AppVM(QubesVM): - '''Application VM''' - pass - - -class StandaloneVM(QubesVM): - '''Standalone Application VM''' - pass - - -class TemplateVM(QubesVM): - '''Template for AppVM''' - pass - - class DispVMWrapper(QubesVM): '''Wrapper class for new DispVM, supporting only service call diff --git a/setup.py b/setup.py index 25b04dd..7c27c3f 100644 --- a/setup.py +++ b/setup.py @@ -38,13 +38,6 @@ if __name__ == '__main__': }, entry_points={ 'console_scripts': list(get_console_scripts()), - 'qubesadmin.vm': [ - 'AppVM = qubesadmin.vm:AppVM', - 'TemplateVM = qubesadmin.vm:TemplateVM', - 'StandaloneVM = qubesadmin.vm:StandaloneVM', - 'AdminVM = qubesadmin.vm:AdminVM', - 'DispVM = qubesadmin.vm:DispVM', - ], }, )