From f354bd1eab5857648b15f920e0cf8e4203c7f333 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Tue, 25 Apr 2017 14:10:39 +0530 Subject: [PATCH] Set terminal width for network *_command modules to avoid paging (#23728) Signed-off-by: Trishna Guha --- lib/ansible/plugins/terminal/eos.py | 3 ++- lib/ansible/plugins/terminal/ios.py | 3 ++- lib/ansible/plugins/terminal/iosxr.py | 2 +- lib/ansible/plugins/terminal/junos.py | 2 +- lib/ansible/plugins/terminal/nxos.py | 3 ++- lib/ansible/plugins/terminal/vyos.py | 3 ++- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/ansible/plugins/terminal/eos.py b/lib/ansible/plugins/terminal/eos.py index ddbdfae1080..98d96b2807a 100644 --- a/lib/ansible/plugins/terminal/eos.py +++ b/lib/ansible/plugins/terminal/eos.py @@ -48,7 +48,8 @@ class TerminalModule(TerminalBase): def on_open_shell(self): try: - self._exec_cli_command('terminal length 0') + for cmd in ['terminal length 0', 'terminal width 512']: + self._exec_cli_command(cmd) except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters') diff --git a/lib/ansible/plugins/terminal/ios.py b/lib/ansible/plugins/terminal/ios.py index 70a9cd60b36..4ce5dc94065 100644 --- a/lib/ansible/plugins/terminal/ios.py +++ b/lib/ansible/plugins/terminal/ios.py @@ -46,7 +46,8 @@ class TerminalModule(TerminalBase): def on_open_shell(self): try: - self._exec_cli_command('terminal length 0') + for cmd in ['terminal length 0', 'terminal width 512']: + self._exec_cli_command(cmd) except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters') diff --git a/lib/ansible/plugins/terminal/iosxr.py b/lib/ansible/plugins/terminal/iosxr.py index 7ccff77ef69..b1a64d638f0 100644 --- a/lib/ansible/plugins/terminal/iosxr.py +++ b/lib/ansible/plugins/terminal/iosxr.py @@ -45,7 +45,7 @@ class TerminalModule(TerminalBase): def on_open_shell(self): try: - for cmd in ['terminal length 0', 'terminal exec prompt no-timestamp']: + for cmd in ['terminal length 0', 'terminal width 512', 'terminal exec prompt no-timestamp']: self._exec_cli_command(cmd) except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters') diff --git a/lib/ansible/plugins/terminal/junos.py b/lib/ansible/plugins/terminal/junos.py index d3c6d0caa4b..d7afd840fd5 100644 --- a/lib/ansible/plugins/terminal/junos.py +++ b/lib/ansible/plugins/terminal/junos.py @@ -49,7 +49,7 @@ class TerminalModule(TerminalBase): if prompt.strip().endswith('%'): display.vvv('starting cli', self._connection._play_context.remote_addr) self._exec_cli_command('cli') - for c in ['set cli timestamp disable', 'set cli screen-length 0']: + for c in ['set cli timestamp disable', 'set cli screen-length 0', 'set cli screen-width 1024']: self._exec_cli_command(c) except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters') diff --git a/lib/ansible/plugins/terminal/nxos.py b/lib/ansible/plugins/terminal/nxos.py index 00cb3f588ce..5d97aafdab2 100644 --- a/lib/ansible/plugins/terminal/nxos.py +++ b/lib/ansible/plugins/terminal/nxos.py @@ -48,7 +48,8 @@ class TerminalModule(TerminalBase): def on_open_shell(self): try: - self._exec_cli_command('terminal length 0') + for cmd in ['terminal length 0', 'terminal width 511']: + self._exec_cli_command(cmd) except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters') diff --git a/lib/ansible/plugins/terminal/vyos.py b/lib/ansible/plugins/terminal/vyos.py index 8b22019f49c..1a78a4695c6 100644 --- a/lib/ansible/plugins/terminal/vyos.py +++ b/lib/ansible/plugins/terminal/vyos.py @@ -43,7 +43,8 @@ class TerminalModule(TerminalBase): def on_open_shell(self): try: - self._exec_cli_command('set terminal length 0') + for cmd in ['set terminal length 0', 'set terminal width 512']: + self._exec_cli_command(cmd) self._exec_cli_command('set terminal length %s' % self.terminal_length) except AnsibleConnectionFailure: raise AnsibleConnectionFailure('unable to set terminal parameters')