1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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]`
This commit is contained in:
Peter Sprygada 2016-11-21 10:47:48 -05:00 committed by John R Barker
parent f68b49057f
commit 69649358b1
2 changed files with 7 additions and 1 deletions

View file

@ -36,7 +36,8 @@ from ansible.module_utils._text import to_native
ANSI_RE = [ ANSI_RE = [
re.compile(r'(\x1b\[\?1h\x1b=)'), re.compile(r'(\x1b\[\?1h\x1b=)'),
re.compile(r'\x08.') re.compile(r'\x08'),
re.compile(r'\x1b[^m]*m')
] ]
def to_list(val): def to_list(val):

View file

@ -27,6 +27,7 @@
# #
import re import re
import os
from ansible.module_utils.network import NetworkModule, NetworkError from ansible.module_utils.network import NetworkModule, NetworkError
from ansible.module_utils.network import register_transport, to_list from ansible.module_utils.network import register_transport, to_list
@ -46,9 +47,13 @@ class Cli(CliBase):
re.compile(r"\n\s+Set failed"), re.compile(r"\n\s+Set failed"),
] ]
TERMINAL_LENGTH = os.getenv('ANSIBLE_VYOS_TERMINAL_LENGTH', 10000)
def connect(self, params, **kwargs): def connect(self, params, **kwargs):
super(Cli, self).connect(params, kickstart=False, **kwargs) super(Cli, self).connect(params, kickstart=False, **kwargs)
self.shell.send('set terminal length 0') self.shell.send('set terminal length 0')
self.shell.send('set terminal length %s' % self.TERMINAL_LENGTH)
### implementation of netcli.Cli ### ### implementation of netcli.Cli ###