mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-08 17:29:11 -07:00
clean up of terminal plugins (#21549)
* removes unneeded supports_multiplexing var * refactors terminal_prompts_re to terminal_stdout_re * refactors terminal_errors_re to terminal_stderr_re * updates network_cli unit test cases
This commit is contained in:
parent
c5452eef6f
commit
a6cecef6bc
11 changed files with 26 additions and 59 deletions
|
@ -25,16 +25,15 @@ import json
|
|||
from ansible.plugins.terminal import TerminalBase
|
||||
from ansible.errors import AnsibleConnectionFailure
|
||||
|
||||
|
||||
class TerminalModule(TerminalBase):
|
||||
|
||||
terminal_prompts_re = [
|
||||
terminal_stdout_re = [
|
||||
re.compile(r"[\r\n]?[\w+\-\.:\/\[\]]+(?:\([^\)]+\)){,3}(?:>|#) ?$"),
|
||||
re.compile(r"\[\w+\@[\w\-\.]+(?: [^\]])\] ?[>#\$] ?$"),
|
||||
re.compile(r']]>]]>[\r\n]?')
|
||||
]
|
||||
|
||||
terminal_errors_re = [
|
||||
terminal_stderr_re = [
|
||||
re.compile(r"% ?Error"),
|
||||
re.compile(r"% ?Bad secret"),
|
||||
re.compile(r"invalid input", re.I),
|
||||
|
@ -44,11 +43,9 @@ class TerminalModule(TerminalBase):
|
|||
re.compile(r"'[^']' +returned error code: ?\d+"),
|
||||
]
|
||||
|
||||
supports_multiplexing = False
|
||||
|
||||
def on_open_shell(self):
|
||||
try:
|
||||
for cmd in ['terminal length 0', 'terminal exec prompt no-timestamp']:
|
||||
self._connection.exec_command(cmd)
|
||||
self._exec_cli_command(cmd)
|
||||
except AnsibleConnectionFailure:
|
||||
raise AnsibleConnectionFailure('unable to set terminal parameters')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue