Pythonic Classes¶
VM¶
The top level VM
object holds common methods for VMs.
It should not be instanciated directly - use the
lower level TemplateVM
and AppVM
objects instead.
-
class
pyqubes.vm.
VM
(name, proactive=False, operating_system='fedora-23')[source]¶ The VM object represants a QubesOS VM. Its methods are common accross both AppVMs and TemplateVMs.
VM should not be instanciated directly - use TemplateVM or AppVM.
By default, all VMs are Fedora 23 based. Other values are listed in
pyqubes.constants
-
enact
(args)[source]¶ Enact a list of command arguments using the VM’s
enact_function
Any one of the functions in
pyqubes.qubes
,``pyqubes.qubesdb`` orpyqubes.qvm
will return arguments in the correct format.
-
firewall_open
()[source]¶ Can be explicity called to open the VM firewall to ‘allow’.
In most cases you should use``with vm.internet``:
vm = TemplateVM('foo') with vm.animate: # Templates are offline be default with vm.internet: # Template now has unrestricted internet access vm.run('curl http://ipecho.net/plain') # Firewall is restored automatically # This will now fail vm.run('curl http://ipecho.net/plain')
-
run
(command, quote=True, **kwargs)[source]¶ Run a command on the VM.
Please note: *
--pass-io
is always set, to run commands synchronously * Commands are automatically encapsulated in single quotes:vm = TemplateVM('spam') vm.run('echo "foo bar"') # produces: qvm-run spam 'echo "foo bar"'
Parameters: quote (bool) – By default command is single quoted - set False
to disable
-
TeamplateVM & AppVM¶
These represent the actual VMs within QubesOS.
Methods mentioned here are specific to the VM type.
-
class
pyqubes.vm.
TemplateVM
(*args, **kwargs)[source]¶ TemplateVM - for installing apps
-
clone
(clone_name, **kwargs)[source]¶ Clone the TemplateVM and return a new TemplateVM
Parameters: clone_name (string) – Name of the new VM Returns: The new TemplateVM
instance
-