ssh-handler 1.0.3__tar.gz → 1.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ssh_handler-1.0.3/ssh_handler.egg-info → ssh_handler-1.0.5}/PKG-INFO +1 -1
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/pyproject.toml +1 -1
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/__init__.py +1 -1
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/core.py +10 -1
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/results.py +5 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5/ssh_handler.egg-info}/PKG-INFO +1 -1
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/LICENSE +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/README.md +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/setup.cfg +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/__main__.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/cli.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/config.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/credentials.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/exceptions.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/ftp.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/pool.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/pyqt_worker.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler/winrm_bootstrap.py +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler.egg-info/SOURCES.txt +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler.egg-info/dependency_links.txt +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler.egg-info/entry_points.txt +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler.egg-info/requires.txt +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/ssh_handler.egg-info/top_level.txt +0 -0
- {ssh_handler-1.0.3 → ssh_handler-1.0.5}/tests/test_offline.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ssh-handler"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.5"
|
|
8
8
|
description = "Extensive SSH/SFTP/SCP/FTP handler built on Paramiko, for test automation, CLIs and PyQt5 tools."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -118,10 +118,17 @@ class SSHHandler:
|
|
|
118
118
|
log_callback: Optional[Callable[[str], None]] = None,
|
|
119
119
|
logger: Optional[logging.Logger] = None,
|
|
120
120
|
safe: bool = False,
|
|
121
|
+
quiet: bool = False,
|
|
121
122
|
):
|
|
123
|
+
"""
|
|
124
|
+
:param quiet: when True, suppress the INFO narration (connect/command
|
|
125
|
+
lines) and emit only warnings and errors. Command results
|
|
126
|
+
are returned in CommandResult.stdout regardless.
|
|
127
|
+
"""
|
|
122
128
|
self.config = config
|
|
123
129
|
self._safe_default = safe
|
|
124
130
|
self._log_callback = log_callback
|
|
131
|
+
self._quiet = quiet
|
|
125
132
|
self.log = logger or self._build_logger()
|
|
126
133
|
|
|
127
134
|
self._client: Optional[paramiko.SSHClient] = None
|
|
@@ -143,7 +150,9 @@ class SSHHandler:
|
|
|
143
150
|
logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s")
|
|
144
151
|
)
|
|
145
152
|
logger.addHandler(handler)
|
|
146
|
-
|
|
153
|
+
# set the level every time so quiet= is honored even if the per-host
|
|
154
|
+
# logger was created by an earlier handler instance
|
|
155
|
+
logger.setLevel(logging.WARNING if self._quiet else logging.INFO)
|
|
147
156
|
return logger
|
|
148
157
|
|
|
149
158
|
def _secrets(self) -> list:
|
|
@@ -31,6 +31,11 @@ class CommandResult:
|
|
|
31
31
|
def ok(self) -> bool:
|
|
32
32
|
return self.exit_code == 0
|
|
33
33
|
|
|
34
|
+
@property
|
|
35
|
+
def text(self) -> str:
|
|
36
|
+
"""stdout with surrounding whitespace/newlines stripped - print-ready."""
|
|
37
|
+
return self.stdout.strip()
|
|
38
|
+
|
|
34
39
|
def __bool__(self) -> bool:
|
|
35
40
|
return self.ok
|
|
36
41
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|