Module mitogen

  • License: ASL 2.0

  • Version: 0.2.1

Entities

entity mitogen::Context

Parents: std::Entity

Base entity for all types of contexts that can be used with the mitogen router. A context can be used via another one using the via relation.

When serialized, the chain of context will form a recursive dict structure that can be used to construct the desired mitogen context object.

attribute string method_name

Value used internally to select the correct connection class when constructing the mitogen context.

attribute string name

The name to give to the constructed context.

relation mitogen::Context via [0:1]

Access the current context (self) via the attached context.

entity mitogen::Local

Parents: mitogen::Context

Construct a context on the local machine as a subprocess of the current process. The associated stream implementation is mitogen.master.Stream.

attribute string method_name='local'
attribute string name=''
attribute string? remote_name=null

The argv[0] suffix for the new process. If remote_name is test, the new process argv[0] will be mitogen:test. If unspecified, defaults to <username>@<hostname>:<pid>. This variable cannot contain slash characters, as the resulting argv[0] must be presented in such a way as to allow Python to determine its installation prefix. This is required to support virtualenv.

attribute string[]? python_path=null

String or list path to the Python interpreter to use for bootstrap. Defaults to sys.executable for local connections, and python for remote connections. It is possible to pass a list to invoke Python wrapped using another tool, such as [“/usr/bin/env”, “python”].

attribute bool? debug=null

If True, arrange for debug logging (enable_debug()) to be enabled in the new context. Automatically True when enable_debug() has been called, but may be used selectively otherwise.

attribute bool? unidirectional=null

If True, arrange for the child’s router to be constructed with unidirectional routing enabled. Automatically True when it was enabled for this router, but may still be explicitly set to False.

attribute bool? profiling=null

If True, arrange for profiling (profiling) to be enabled in the new context. Automatically True when profiling is True, but may be used selectively otherwise.

The following implements statements select implementations for this entity:

entity mitogen::Ssh

Parents: mitogen::Local

Construct a remote context over an OpenSSH ssh invocation.

The ssh process is started in a newly allocated pseudo-terminal to support typing interactive passwords and responding to prompts, if a password is specified, or check_host_keys=accept. In other scenarios, BatchMode is enabled and no PTY is allocated. For many-target configurations, both options should be avoided as most systems have a conservative limit on the number of pseudo-terminals that may exist.

attribute string method_name='ssh'
attribute string hostname
attribute string? username=null

The SSH username; default is unspecified, which causes SSH to pick the username to use.

attribute string? ssh_path=null

Absolute or relative path to ssh. Defaults to ssh.

attribute string[]? ssh_args=null

Additional arguments to pass to the SSH command.

attribute int? port=null

Port number to connect to; default is unspecified, which causes SSH to pick the port number.

attribute string? check_host_keys=null

Specifies the SSH host key checking mode. Defaults to enforce. ignore: no host key checking is performed. Connections never fail due to an unknown or changed host key. accept: known hosts keys are checked to ensure they match, new host keys are automatically accepted and verified in future connections. enforce: known host keys are checked to ensure they match, unknown hosts cause a connection failure.

attribute string? password=null

Password to type if/when ssh requests it. If not specified and a password is requested, mitogen.ssh.PasswordError is raised.

attribute string? identity_file=null

Path to an SSH private key file to use for authentication. Default is unspecified, which causes SSH to pick the identity file. When this option is specified, only identity_file will be used by the SSH client to perform authenticaion; agent authentication is automatically disabled, as is reading the default private key from ~/.ssh/id_rsa, or ~/.ssh/id_dsa.

attribute bool? identities_only=null

If True and a password or explicit identity file is specified, instruct the SSH client to disable any authentication identities inherited from the surrounding environment, such as those loaded in any running ssh-agent, or default key files present in ~/.ssh. This ensures authentication attempts only occur using the supplied password or SSH key.

attribute bool? compression=null

If True, enable ssh compression support. Compression has a minimal effect on the size of modules transmitted, as they are already compressed, however it has a large effect on every remaining message in the otherwise uncompressed stream protocol, such as function call arguments and return values.

attribute int? ssh_debug_level=null

Optional integer 0..3 indicating the SSH client debug level.

The following implements statements select implementations for this entity:

entity mitogen::Sudo

Parents: mitogen::Local

Construct a context on the local machine over a sudo invocation. The sudo process is started in a newly allocated pseudo-terminal, and supports typing interactive passwords.

attribute string method_name='sudo'
attribute string name=''
attribute string? username=null

Username to pass to sudo as the -u parameter, defaults to root.

attribute string? sudo_path=null

Filename or complete path to the sudo binary. PATH will be searched if given as a filename. Defaults to sudo.

attribute string? password=null

The password to use if/when sudo requests it. Depending on the sudo configuration, this is either the current account password or the target account password. mitogen.sudo.PasswordError will be raised if sudo requests a password but none is provided.

attribute bool? set_home=null

If True, request sudo set the HOME environment variable to match the target UNIX account.

attribute bool? preserve_env=null

If True, request sudo to preserve the environment of the parent process.

attribute string? selinux_type=null

If not None, the SELinux security context to use.

attribute string? selinux_role=null

If not None, the SELinux role to use.

attribute string[]? sudo_args=null

Arguments in the style of sys.argv that would normally be passed to sudo. The arguments are parsed in-process to set equivalent parameters. Re-parsing ensures unsupported options cause mitogen.core.StreamError to be raised, and that attributes of the stream match the actual behaviour of sudo.

The following implements statements select implementations for this entity: