Code¶
The code can be found on GitHub.
vmupdate.channel¶
Provide wrapper classes around virtual machine communication.
-
class
vmupdate.channel.
Channel
(hostname, port)[source]¶ Bases:
object
Provide virtual machine communication.
Variables: - hostname (str) – name or IP of the virtual machine
- port (int) – port of the virtual machine
-
connect
(username, password)[source]¶ Connect to the virtual machine.
Parameters: - username (str) – username for authentication
- password (str) – password for authentication
-
run
(args)[source]¶ Run command against the virtual machine and return a
ChannelCommand
.Parameters: args (str or list) – the command to be run Return type: ChannelCommand
vmupdate.cli¶
Provide the main entry point and command line parsing.
-
vmupdate.cli.
main
()[source]¶ Initialize environment and call
host.update_all_vms()
.This is the main entry point for vmupdate.
Returns: exitcode Return type: int
vmupdate.config¶
Provide a wrapper around configuration.
vmupdate.constants¶
Provide constants for vmupdate.
-
vmupdate.constants.
OS_ARCH
= 'Arch'¶ VM OS Arch
-
vmupdate.constants.
OS_DEBIAN
= 'Debian'¶ VM OS Debian
-
vmupdate.constants.
OS_FEDORA
= 'Fedora'¶ VM OS Fedora
-
vmupdate.constants.
OS_GENTOO
= 'Gentoo'¶ VM OS Gentoo
-
vmupdate.constants.
OS_LINUX
= 'Linux'¶ VM OS Linux
-
vmupdate.constants.
OS_MAC_OS_X
= 'Mac OS X'¶ VM OS Mac OS X
-
vmupdate.constants.
OS_MANDRIVA
= 'Mandriva'¶ VM OS Mandriva
-
vmupdate.constants.
OS_OPENSUSE
= 'openSUSE'¶ VM OS openSUSE
-
vmupdate.constants.
OS_ORACLE
= 'Oracle'¶ VM OS Oracle
-
vmupdate.constants.
OS_REDHAT
= 'Red Hat'¶ VM OS Red Hat
-
vmupdate.constants.
OS_TURBOLINUX
= 'Turbolinux'¶ VM OS Turbolinux
-
vmupdate.constants.
OS_UBUNTU
= 'Ubuntu'¶ VM OS Ubuntu
-
vmupdate.constants.
OS_UNKNOWN
= 'Unknown'¶ VM OS Unknown
-
vmupdate.constants.
OS_WINDOWS
= 'Windows'¶ VM OS Windows
-
vmupdate.constants.
OS_XANDROS
= 'Xandros'¶ VM OS Xandros
-
vmupdate.constants.
VM_PAUSED
= 3¶ VM State Paused
-
vmupdate.constants.
VM_RUNNING
= 1¶ VM State Running
-
vmupdate.constants.
VM_STOPPED
= 0¶ VM State Stopped
-
vmupdate.constants.
VM_SUSPENDED
= 2¶ VM State Suspended
-
vmupdate.constants.
VM_UNKNOWN
= -1¶ VM State Unknown
vmupdate.credentials¶
Provide functions for accessing credential information from the config and keyring.
-
vmupdate.credentials.
get_credentials
(uid)[source]¶ Return the configured credentials for the virtual machine.
Parameters: uid (str) – name of the virtual machine Returns: tuple of (username, password) Return type: (str, str)
-
vmupdate.credentials.
get_password
(username, uid)[source]¶ Return the password for the
username
and virtual machine.Parameters: - username (str) – username associated with the password
- uid (str) – name of the virtual machine
Returns: password
Return type: str
vmupdate.errors¶
Provide application-specific error classes.
-
exception
vmupdate.errors.
AppError
[source]¶ Bases:
exceptions.Exception
Provide base class for application-specific errors.
-
exception
vmupdate.errors.
SshError
[source]¶ Bases:
vmupdate.errors.AppError
Provide class for SSH errors.
-
exception
vmupdate.errors.
UpdateError
[source]¶ Bases:
vmupdate.errors.AppError
Provide class for update errors.
vmupdate.host¶
Provide functions to find and update VM’s.
vmupdate.pkgmgr¶
Provide functions to query and command package managers.
-
vmupdate.pkgmgr.
get_pkgmgrs
(vm)[source]¶ Return all package managers on the virtual machine.
Parameters: vm ( VM
) – virtual machine to targetReturns: list of tuples of (name, list of paths) Return type: list((str, list(str)))
-
vmupdate.pkgmgr.
run_pkgmgr
(vm, pkgmgr, cmds)[source]¶ Run the package manager commands on the virtual machine in sequence.
Parameters: - vm (
VM
) – virtual machine to target - pkgmgr (str) – name of the package manager to run
- cmds (list(str)) – list of commands to run in sequence
Raises: UpdateError – if any command does not exit with
0
- vm (
vmupdate.shells¶
Provide a transparent abstraction for interacting with shells.
vmupdate.virtualizers¶
Provide a transparent abstraction for interacting with virtualizers.
vmupdate.vm¶
Provide a wrapper class around VM interactions.
-
class
vmupdate.vm.
VM
(virtualizer, uid)[source]¶ Bases:
object
Provide virtual machine interface.
Variables: - virtualizer (
Virtualizer
) – virtualizer that the virtual machine runs under - uid (str) – identifier of the virtual machine
-
enable_ssh
(host_port)[source]¶ Enable SSH port forwarding for the virtual machine.
Parameters: host_port (int) – the post on the host to forward to the guest Returns: exitcode Return type: int
-
get_os
()[source]¶ Return the operating system of the virtual machine.
Possible values can be found in
constants
.Return type: str
-
get_ssh_info
()[source]¶ Return the SSH connection information for the virtual machine.
Returns: tuple of (hostname, port) Return type: (str, int)
-
get_status
()[source]¶ Return the status of the virtual machine.
Possible values can be found in
constants
.Return type: str
-
shell_name
¶ Return the name of the shell.
Return type: str
-
ssh_port
¶ Return the SSH port of the guest.
Return type: int
- virtualizer (