Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: python
os: linux
python:
- &main_python 2.7
- 3.4
- &pypy pypy
install:
- &upgrade_python_toolset pip install --upgrade pip setuptools wheel
Expand All @@ -17,7 +16,7 @@ jobs:
fast_finish: true
include:
- stage: Static analisys
python: 3.4
python: 3.6
services: []
install:
- *upgrade_python_toolset
Expand All @@ -27,7 +26,7 @@ jobs:
after_success: skip

- stage: Code style check
python: 3.4
python: *main_python
install:
- *upgrade_python_toolset
- pip install tox
Expand All @@ -43,8 +42,7 @@ jobs:
services: []
install:
- *upgrade_python_toolset
script:
- ./tools/run_docker.sh "exec_helpers"
script: []
before_deploy:
- pip install -r build_requirements.txt
- python setup.py bdist_wheel
Expand Down
21 changes: 10 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ Pros:
::

Python 2.7
Python 3.4
PyPy

.. note:: Update to version 2.0+ for usage with python 3.5+. This version is for legacy python and no new features are planned.
.. note:: Update to version 2.0+ for usage with python 3.4+. This version is for legacy python and no new features are planned.

This package includes:

Expand Down Expand Up @@ -127,7 +126,7 @@ This methods are almost the same for `SSHCleint` and `Subprocess`, except specif
result = helper.execute(
command, # type: str
verbose=False, # type: bool
timeout=1 * 60 * 60, # type: typing.Optional[int]
timeout=1 * 60 * 60, # type: typing.Union[int, float, None]
**kwargs
)

Expand All @@ -137,7 +136,7 @@ This methods are almost the same for `SSHCleint` and `Subprocess`, except specif
result = helper.check_call(
command, # type: str
verbose=False, # type: bool
timeout=1 * 60 * 60, # type: typing.Optional[int]
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
error_info=None, # type: typing.Optional[str]
expected=None, # type: typing.Optional[typing.Iterable[int]]
raise_on_err=True, # type: bool
Expand All @@ -149,7 +148,7 @@ This methods are almost the same for `SSHCleint` and `Subprocess`, except specif
result = helper.check_stderr(
command, # type: str
verbose=False, # type: bool
timeout=1 * 60 * 60, # type: typing.Optional[int]
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
error_info=None, # type: typing.Optional[str]
raise_on_err=True, # type: bool
)
Expand Down Expand Up @@ -185,10 +184,10 @@ Execution result object has a set of useful properties:
* `stderr` -> `typing.Tuple[bytes]`. Raw stderr output.
* `stdout_bin` -> `bytearray`. Binary stdout output.
* `stderr_bin` -> `bytearray`. Binary stderr output.
* `stdout_str` -> `six.text_types`. Text representation of output.
* `stderr_str` -> `six.text_types`. Text representation of output.
* `stdout_brief` -> `six.text_types`. Up to 7 lines from stdout (3 first and 3 last if >7 lines).
* `stderr_brief` -> `six.text_types`. Up to 7 lines from stderr (3 first and 3 last if >7 lines).
* `stdout_str` -> `typing.Text`. Text representation of output.
* `stderr_str` -> `typing.Text`. Text representation of output.
* `stdout_brief` -> `typing.Text`. Up to 7 lines from stdout (3 first and 3 last if >7 lines).
* `stderr_brief` -> `typing.Text`. Up to 7 lines from stderr (3 first and 3 last if >7 lines).

* `stdout_json` - STDOUT decoded as JSON.

Expand All @@ -209,7 +208,7 @@ Possible to call commands in parallel on multiple hosts if it's not produce huge
results = SSHClient.execute_together(
remotes, # type: typing.Iterable[SSHClient]
command, # type: str
timeout=1 * 60 * 60, # type: typing.Optional[int]
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
expected=None, # type: typing.Optional[typing.Iterable[int]]
raise_on_err=True # type: bool
)
Expand All @@ -227,7 +226,7 @@ For execute through SSH host can be used `execute_through_host` method:
command, # type: str
auth=None, # type: typing.Optional[SSHAuth]
target_port=22, # type: int
timeout=1 * 60 * 60, # type: typing.Optional[int]
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
verbose=False, # type: bool
get_pty=False, # type: bool
)
Expand Down
8 changes: 4 additions & 4 deletions doc/source/ExecResult.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ API: ExecResult
:param cmd: command
:type cmd: ``str``
:param stdin: STDIN
:type stdin: ``typing.Optional[str]``
:type stdin: ``typing.Union[bytes, str, bytearray, None]``
:param stdout: binary STDOUT
:type stdout: ``typing.Optional[typing.Iterable[bytes]]``
:param stderr: binary STDERR
Expand All @@ -40,17 +40,17 @@ API: ExecResult

.. py:attribute:: stdin

``typing.Text``
``typing.Optional[str]``
Stdin input as string.

.. py:attribute:: stdout

``typing.Tuple[bytes]``
``typing.Tuple[bytes, ...]``
Stdout output as list of binaries.

.. py:attribute:: stderr

``typing.Tuple[bytes]``
``typing.Tuple[bytes, ...]``
Stderr output as list of binaries.

.. py:attribute:: stdout_bin
Expand Down
12 changes: 6 additions & 6 deletions doc/source/SSHClient.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ API: SSHClient and SSHAuth.
:param command: Command for execution
:type command: ``str``
:param stdin: pass STDIN text to the process
:type stdin: ``typing.Union[typing.AnyStr, bytearray, None]``
:type stdin: ``typing.Union[str, bytes, bytearray, None]``
:param open_stdout: open STDOUT stream for read
:type open_stdout: bool
:param open_stderr: open STDERR stream for read
Expand All @@ -153,7 +153,7 @@ API: SSHClient and SSHAuth.
:param verbose: Produce log.info records for command call and output
:type verbose: ``bool``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:rtype: ExecResult
:raises ExecHelperTimeoutError: Timeout exceeded

Expand All @@ -168,7 +168,7 @@ API: SSHClient and SSHAuth.
:param verbose: Produce log.info records for command call and output
:type verbose: ``bool``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:param error_info: Text for error details, if fail happens
:type error_info: ``typing.Optional[str]``
:param expected: expected return codes (0 by default)
Expand All @@ -190,7 +190,7 @@ API: SSHClient and SSHAuth.
:param verbose: Produce log.info records for command call and output
:type verbose: ``bool``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:param error_info: Text for error details, if fail happens
:type error_info: ``typing.Optional[str]``
:param raise_on_err: Raise exception on unexpected return code
Expand All @@ -217,7 +217,7 @@ API: SSHClient and SSHAuth.
:param verbose: Produce log.info records for command call and output
:type verbose: ``bool``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:param get_pty: open PTY on target machine
:type get_pty: ``bool``
:rtype: ExecResult
Expand All @@ -234,7 +234,7 @@ API: SSHClient and SSHAuth.
:param command: Command for execution
:type command: ``str``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:param expected: expected return codes (0 by default)
:type expected: ``typing.Optional[typing.Iterable[]]``
:param raise_on_err: Raise exception on unexpected return code
Expand Down
8 changes: 4 additions & 4 deletions doc/source/Subprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ API: Subprocess
:param command: Command for execution
:type command: str
:param stdin: pass STDIN text to the process
:type stdin: ``typing.Union[typing.AnyStr, bytearray, None]``
:type stdin: ``typing.Union[str, bytes, bytearray, None]``
:param open_stdout: open STDOUT stream for read
:type open_stdout: ``bool``
:param open_stderr: open STDERR stream for read
Expand All @@ -69,7 +69,7 @@ API: Subprocess
:param verbose: Produce log.info records for command call and output
:type verbose: ``bool``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:rtype: ExecResult
:raises ExecHelperTimeoutError: Timeout exceeded

Expand All @@ -88,7 +88,7 @@ API: Subprocess
:param verbose: Produce log.info records for command call and output
:type verbose: ``bool``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:param error_info: Text for error details, if fail happens
:type error_info: ``typing.Optional[str]``
:param expected: expected return codes (0 by default)
Expand All @@ -111,7 +111,7 @@ API: Subprocess
:param verbose: Produce log.info records for command call and output
:type verbose: ``bool``
:param timeout: Timeout for command execution.
:type timeout: ``typing.Union[int, None]``
:type timeout: ``typing.Union[int, float, None]``
:param error_info: Text for error details, if fail happens
:type error_info: ``typing.Optional[str]``
:param raise_on_err: Raise exception on unexpected return code
Expand Down
2 changes: 1 addition & 1 deletion doc/source/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ API: exceptions

.. py:attribute:: timeout

``int``
``typing.Union[int, float]``

.. py:attribute:: result

Expand Down
Loading