diff options
author | Peter Sprygada <privateip@users.noreply.github.com> | 2016-11-21 10:47:48 -0500 |
---|---|---|
committer | John R Barker <john@johnrbarker.com> | 2016-11-21 15:47:48 +0000 |
commit | 69649358b10e7b30ed792906db302eaec9640c7a (patch) | |
tree | e7f6af1b5f17f013ceb1ed084d28cdad74ec254a | |
parent | f68b49057f9ebdfb2c8cced556420b620875bfa9 (diff) | |
download | ansible-69649358b10e7b30ed792906db302eaec9640c7a.tar.gz |
fixes issue with setting the terminal length (pager) in vyos (#18546)
`set terminal length 0` actually sets `VYATTA_PAGER=cat`
`set terminal length [some number]` actually sets `stty length [some number]`
-rw-r--r-- | lib/ansible/module_utils/shell.py | 3 | ||||
-rw-r--r-- | lib/ansible/module_utils/vyos.py | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/shell.py b/lib/ansible/module_utils/shell.py index 5a1fccb203..2f30f58a06 100644 --- a/lib/ansible/module_utils/shell.py +++ b/lib/ansible/module_utils/shell.py @@ -36,7 +36,8 @@ from ansible.module_utils._text import to_native ANSI_RE = [ re.compile(r'(\x1b\[\?1h\x1b=)'), - re.compile(r'\x08.') + re.compile(r'\x08'), + re.compile(r'\x1b[^m]*m') ] def to_list(val): diff --git a/lib/ansible/module_utils/vyos.py b/lib/ansible/module_utils/vyos.py index a0edaa6b87..90a21d4712 100644 --- a/lib/ansible/module_utils/vyos.py +++ b/lib/ansible/module_utils/vyos.py @@ -27,6 +27,7 @@ # import re +import os from ansible.module_utils.network import NetworkModule, NetworkError from ansible.module_utils.network import register_transport, to_list @@ -46,9 +47,13 @@ class Cli(CliBase): re.compile(r"\n\s+Set failed"), ] + TERMINAL_LENGTH = os.getenv('ANSIBLE_VYOS_TERMINAL_LENGTH', 10000) + + def connect(self, params, **kwargs): super(Cli, self).connect(params, kickstart=False, **kwargs) self.shell.send('set terminal length 0') + self.shell.send('set terminal length %s' % self.TERMINAL_LENGTH) ### implementation of netcli.Cli ### |