class StubSessionForStubAvatarWithEnv(StubSessionForStubAvatar): (source)
Implements interfaces: twisted.conch.interfaces.ISessionSetEnv
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 | get |
Just a simple implementation which records the current environment when PTY is requested. |
Method | set |
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 | environ |
Undocumented |
Inherited from StubSessionForStubAvatar
:
Method | closed |
Note that close has been received. |
Method | eof |
Note that EOF has been received. |
Method | exec |
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 | open |
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 | window |
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 | exec |
if present, the command line passed to the execCommand method. |
Instance Variable | exec |
if present, the SSHSessionProcessProtocol passed to the execCommand method. |
Instance Variable | exec |
if present, the EchoTransport connected to execProtocol. |
Instance Variable | got |
if present, a closed message was received. |
Instance Variable | got |
if present, an EOF message was received. |
Instance Variable | pty |
if present, the terminal, window size, and modes passed to the getPty method. |
Instance Variable | shell |
if present, the SSHSessionProcessProtocol passed to the openShell method. |
Instance Variable | shell |
if present, the EchoTransport connected to shellProtocol. |
Instance Variable | window |
if present, the window size passed to the windowChangned method. |
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.)