01QubesAppVm.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/python2
  2. # -*- coding: utf-8 -*-
  3. #
  4. # The Qubes OS Project, http://www.qubes-os.org
  5. #
  6. # Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
  7. # Copyright (C) 2013 Marek Marczykowski <marmarek@invisiblethingslab.com>
  8. #
  9. # This program is free software; you can redistribute it and/or
  10. # modify it under the terms of the GNU General Public License
  11. # as published by the Free Software Foundation; either version 2
  12. # of the License, or (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program; if not, write to the Free Software
  21. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  22. #
  23. #
  24. import os.path
  25. from qubes.qubes import QubesVm,QubesVmLabel,register_qubes_vm_class,system_path
  26. class QubesAppVm(QubesVm):
  27. """
  28. A class that represents an AppVM. A child of QubesVm.
  29. """
  30. def get_attrs_config(self):
  31. attrs_config = super(QubesAppVm, self).get_attrs_config()
  32. attrs_config['dir_path']['func'] = \
  33. lambda value: value if value is not None else \
  34. os.path.join(system_path["qubes_appvms_dir"], self.name)
  35. return attrs_config
  36. @property
  37. def type(self):
  38. return "AppVM"
  39. def is_appvm(self):
  40. return True
  41. register_qubes_vm_class(QubesAppVm)