8 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04b294917f | |||
| a58220a131 | |||
| 61c1a628a1 | |||
| 737cbc3e24 | |||
| 279b7789e2 | |||
| 3a84408436 | |||
| f4c76ebab9 | |||
| f37f025b17 |
Renamed from src/python/jw/pkg/lib/SSHClient.py (Browse further)
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| 04b294917f |
lib.ExecContext: Support bytes-typed cmd_input
The Input instance passed as cmd_input to ExecContext.run() and .sudo() currently may be of type str. Allow to pass bytes, too. At the same time, disallow None to be passed as cmd_input. Force the caller to be more explicit how it wants input to be handled, notably with respect to interactivity. Along the way fix a bug: Content in cmd_input should result in CallContext.interactive == False but doesn't. Fix that. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| a58220a131 |
lib.ec.SSHClient.ssh_client(): Add type parameter
ssh_client() tries a predefined order of client class implementations until it finds a workable candidate. For testing all, it's desirable to be able to target the exact class. Add a "type" parameter to achieve that. I'm aware that type is also a function. But the semantics look so compelling to me that I'm using the variable name anyway. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 61c1a628a1 |
lib.ec.SSHClient: Exception for empty host name
Instantiating a SSHClient-derived class with an invalid or missing uri parameter is accepted and fails later down the road. Raise an Exception early on to make the error log more comprehensible. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 737cbc3e24 |
lib.ec.ssh.AsyncSSH: Add class
Add a SSHClient implementation using AsyncSSH. This is the first and currently only class derived from SSHClient which implements SSHClient.Cap.LogOutput, designed to consume and log command output as it streams in. It felt like the lower hanging fruit not to do that with Paramiko: Paramiko doesn't provide a native async API, so it would need to spawn additional worker threads. I think. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 279b7789e2 |
lib.ec.SSHClient: Add property port
Add a port property to SSHClient, parsed from the ctor's URL, to supply the obvious information. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| 3a84408436 |
lib.ec.SSHClient.__init__(): Add parameter caps
Add an optional caps ("capabilities") argument to the constructor of SSHClient. It is meant to be used by derived classes in order to declare that they don't want the base class to handle a default behaviour for a certain capability, but that they want to implement it themselves instead. Also, give the _run_ssh() callbacks the necessary info as parameters, so that the derived classes have the means to do so. Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| f4c76ebab9 |
lib.ec.SSHClientInternal|SSHClientCmd: Own .py
Move the code of SSHClientInternal and SSCClientCmd into lib.ec.ssh, as "Paramiko" and "Exec", respectively. This makes the class layout a little more modular, and along the way fixes a bug where SSHClientInternal could be instantiated but was unusable (if the Paramiko is not installed). Signed-off-by: Jan Lindemann <jan@janware.com> |
|||
| f37f025b17 |
lib.SSHClient: Move to lib.ec
SSHClient in an ExecContext, hence it's better off in lib.ec, move it there and adapt the references. Signed-off-by: Jan Lindemann <jan@janware.com> |