@@ -121,7 +121,7 @@ API: SSHClient and SSHAuth.
121121 .. Note :: Enter and exit ssh context manager is produced as well.
122122 .. versionadded :: 1.2.1
123123
124- .. py :method :: execute_async(command, stdin = None , open_stdout = True , open_stderr = True , verbose = False , log_mask_re = None , ** kwargs)
124+ .. py :method :: execute_async(command, stdin = None , open_stdout = True , open_stderr = True , verbose = False , log_mask_re = None , * , get_pty = False , width = 80 , height = 24 , * * kwargs)
125125
126126 Execute command in async mode and return channel with IO objects.
127127
@@ -138,12 +138,19 @@ API: SSHClient and SSHAuth.
138138 :param log_mask_re: regex lookup rule to mask command for logger.
139139 all MATCHED groups will be replaced by '<*masked *>'
140140 :type log_mask_re: typing.Optional[str]
141+ :param get_pty: Get PTY for connection
142+ :type get_pty: bool
143+ :param width: PTY width
144+ :type width: int
145+ :param height: PTY height
146+ :type height: int
141147 :rtype: SshExecuteAsyncResult
142148
143149 .. versionchanged :: 1.2.0 open_stdout and open_stderr flags
144150 .. versionchanged :: 1.2.0 stdin data
145151 .. versionchanged :: 1.2.0 get_pty moved to `**kwargs`
146152 .. versionchanged :: 2.1.0 Use typed NamedTuple as result
153+ .. versionchanged :: 3.2.0 Expose pty options as optional keyword-only arguments
147154
148155 .. py :method :: execute(command, verbose = False , timeout = 1 * 60 * 60 , ** kwargs)
149156
@@ -160,7 +167,7 @@ API: SSHClient and SSHAuth.
160167
161168 .. versionchanged :: 1.2.0 default timeout 1 hour
162169
163- .. py :method :: check_call(command, verbose = False , timeout = 1 * 60 * 60 , error_info = None , expected = None , raise_on_err = True , ** kwargs)
170+ .. py :method :: check_call(command, verbose = False , timeout = 1 * 60 * 60 , error_info = None , expected = None , raise_on_err = True , * , exception_class = CalledProcessError, * * kwargs)
164171
165172 Execute command and check for return code.
166173
@@ -176,13 +183,16 @@ API: SSHClient and SSHAuth.
176183 :type expected: ``typing.Optional[typing.Iterable[int]] ``
177184 :param raise_on_err: Raise exception on unexpected return code
178185 :type raise_on_err: ``bool ``
186+ :param exception_class: Exception class for errors. Subclass of CalledProcessError is mandatory.
187+ :type exception_class: typing.Type[CalledProcessError]
179188 :rtype: ExecResult
180189 :raises ExecHelperTimeoutError: Timeout exceeded
181190 :raises CalledProcessError: Unexpected exit code
182191
183192 .. versionchanged :: 1.2.0 default timeout 1 hour
193+ .. versionchanged :: 3.2.0 Exception class can be substituted
184194
185- .. py :method :: check_stderr(command, verbose = False , timeout = 1 * 60 * 60 , error_info = None , raise_on_err = True , ** kwargs)
195+ .. py :method :: check_stderr(command, verbose = False , timeout = 1 * 60 * 60 , error_info = None , raise_on_err = True , * , expected = None , exception_class = CalledProcessError, * * kwargs)
186196
187197 Execute command expecting return code 0 and empty STDERR.
188198
@@ -196,14 +206,18 @@ API: SSHClient and SSHAuth.
196206 :type error_info: ``typing.Optional[str] ``
197207 :param raise_on_err: Raise exception on unexpected return code
198208 :type raise_on_err: ``bool ``
209+ :param expected: expected return codes (0 by default)
210+ :type expected: typing.Optional[typing.Iterable[typing.Union[int, ExitCodes]]]
211+ :param exception_class: Exception class for errors. Subclass of CalledProcessError is mandatory.
212+ :type exception_class: typing.Type[CalledProcessError]
199213 :rtype: ExecResult
200214 :raises ExecHelperTimeoutError: Timeout exceeded
201215 :raises CalledProcessError: Unexpected exit code or stderr presents
202216
203- .. note :: expected return codes can be overridden via kwargs.
204217 .. versionchanged :: 1.2.0 default timeout 1 hour
218+ .. versionchanged :: 3.2.0 Exception class can be substituted
205219
206- .. py :method :: execute_through_host(hostname, command, auth = None , target_port = 22 , verbose = False , timeout = 1 * 60 * 60 , get_pty = False , ** kwargs)
220+ .. py :method :: execute_through_host(hostname, command, auth = None , target_port = 22 , verbose = False , timeout = 1 * 60 * 60 , * , get_pty = False , width = 80 , height = 24 , ** kwargs)
207221
208222 Execute command on remote host through currently connected host.
209223
@@ -221,12 +235,18 @@ API: SSHClient and SSHAuth.
221235 :type timeout: ``typing.Union[int, float, None] ``
222236 :param get_pty: open PTY on target machine
223237 :type get_pty: ``bool ``
238+ :param width: PTY width
239+ :type width: int
240+ :param height: PTY height
241+ :type height: int
224242 :rtype: ExecResult
225243 :raises ExecHelperTimeoutError: Timeout exceeded
226244
227245 .. versionchanged :: 1.2.0 default timeout 1 hour
246+ .. versionchanged :: 3.2.0 Expose pty options as optional keyword-only arguments
247+ .. versionchanged :: 3.2.0 Exception class can be substituted
228248
229- .. py :classmethod :: execute_together(remotes, command, timeout = 1 * 60 * 60 , expected = None , raise_on_err = True , ** kwargs)
249+ .. py :classmethod :: execute_together(remotes, command, timeout = 1 * 60 * 60 , expected = None , raise_on_err = True , * , exception_class = ParallelCallProcessError, * * kwargs)
230250
231251 Execute command on multiple remotes in async mode.
232252
@@ -240,12 +260,15 @@ API: SSHClient and SSHAuth.
240260 :type expected: ``typing.Optional[typing.Iterable[]] ``
241261 :param raise_on_err: Raise exception on unexpected return code
242262 :type raise_on_err: ``bool ``
263+ :param exception_class: Exception to raise on error. Mandatory subclass of ParallelCallProcessError
264+ :type exception_class: typing.Type[ParallelCallProcessError]
243265 :return: dictionary {(hostname, port): result}
244266 :rtype: typing.Dict[typing.Tuple[str, int], ExecResult]
245267 :raises ParallelCallProcessError: Unexpected any code at lest on one target
246268 :raises ParallelCallExceptions: At lest one exception raised during execution (including timeout)
247269
248270 .. versionchanged :: 1.2.0 default timeout 1 hour
271+ .. versionchanged :: 3.2.0 Exception class can be substituted
249272
250273 .. py :method :: open (path, mode = ' r' )
251274
0 commit comments