class documentation

class StubSessionForStubAvatarWithEnv(StubSessionForStubAvatar): (source)

Implements interfaces: twisted.conch.interfaces.ISessionSetEnv

View In Hierarchy

Same as StubSessionForStubAvatar, but supporting environment variables setting.

End users would want to have the same class annotated with @implementer(session.ISession, session.ISessionSetEnv). The interfaces are split for backwards compatibility, so we split it here to test this compatibility too.

Method __init__ Store the avatar we're adapting.
Method getPty Just a simple implementation which records the current environment when PTY is requested.
Method setEnv If the requested environment variable is 'FAIL', fail. If it is 'IGNORED', raise EnvironmentVariableNotPermitted, which should cause it to be silently ignored. Otherwise, store the requested environment variable.
Instance Variable environ a dict of environment variables passed to the setEnv method.
Instance Variable environAtPty Undocumented

Inherited from StubSessionForStubAvatar:

Method closed Note that close has been received.
Method eofReceived Note that EOF has been received.
Method execCommand If the command is 'true', store the command, the process protocol, and the transport we connect to the process protocol. Otherwise, just store the command and raise an error.
Method openShell If we have gotten a shell request before, fail. Otherwise, store the process protocol in the shellProtocol variable, connect it to the EchoTransport and store that as shellTransport.
Method windowChanged If all the window sizes are 0, fail. Otherwise, store the size in the windowChange variable.
Instance Variable avatar the StubAvatar we are adapting.
Instance Variable execCommandLine if present, the command line passed to the execCommand method.
Instance Variable execProtocol if present, the SSHSessionProcessProtocol passed to the execCommand method.
Instance Variable execTransport if present, the EchoTransport connected to execProtocol.
Instance Variable gotClosed if present, a closed message was received.
Instance Variable gotEOF if present, an EOF message was received.
Instance Variable ptyRequest if present, the terminal, window size, and modes passed to the getPty method.
Instance Variable shellProtocol if present, the SSHSessionProcessProtocol passed to the openShell method.
Instance Variable shellTransport if present, the EchoTransport connected to shellProtocol.
Instance Variable windowChange if present, the window size passed to the windowChangned method.
def __init__(self, avatar): (source)

Store the avatar we're adapting.

def getPty(self, term, windowSize, modes): (source)

Just a simple implementation which records the current environment when PTY is requested.

def setEnv(self, name, value): (source)

If the requested environment variable is 'FAIL', fail. If it is 'IGNORED', raise EnvironmentVariableNotPermitted, which should cause it to be silently ignored. Otherwise, store the requested environment variable.

(Real applications should normally implement an allowed list rather than a blocked list.)

a dict of environment variables passed to the setEnv method.

environAtPty = (source)

Undocumented