From 5434bff093240ad64f6c41c5aabed7a67631ccc6 Mon Sep 17 00:00:00 2001 From: Ganesh B Nalawade Date: Thu, 5 Mar 2020 12:42:32 +0530 Subject: Fix vyos terminal length issue Fixes https://github.com/ansible/ansible/issues/68031 Convert value to env variable ANSIBLE_VYOS_TERMINAL_LENGTH to integer to identify if the value is valid integer string if not raise an execption --- plugins/terminal/vyos.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/terminal/vyos.py b/plugins/terminal/vyos.py index fe7712f6..82839277 100644 --- a/plugins/terminal/vyos.py +++ b/plugins/terminal/vyos.py @@ -40,7 +40,11 @@ class TerminalModule(TerminalBase): re.compile(br"\n\s+Set failed"), ] - terminal_length = os.getenv("ANSIBLE_VYOS_TERMINAL_LENGTH", 10000) + try: + terminal_length = os.getenv('ANSIBLE_VYOS_TERMINAL_LENGTH', 10000) + terminal_length = int(terminal_length) + except ValueError: + raise AnsibleConnectionFailure("Invalid value set for vyos terminal length '%s', value should be a valid integer string" % terminal_length) def on_open_shell(self): try: -- cgit v1.2.3 From cdfed725635e5eb9a54549c122c9657f09a967ea Mon Sep 17 00:00:00 2001 From: Ganesh B Nalawade Date: Thu, 5 Mar 2020 15:17:42 +0530 Subject: Fix CI issues --- plugins/terminal/vyos.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/terminal/vyos.py b/plugins/terminal/vyos.py index 82839277..606f77b1 100644 --- a/plugins/terminal/vyos.py +++ b/plugins/terminal/vyos.py @@ -41,10 +41,13 @@ class TerminalModule(TerminalBase): ] try: - terminal_length = os.getenv('ANSIBLE_VYOS_TERMINAL_LENGTH', 10000) + terminal_length = os.getenv("ANSIBLE_VYOS_TERMINAL_LENGTH", 10000) terminal_length = int(terminal_length) except ValueError: - raise AnsibleConnectionFailure("Invalid value set for vyos terminal length '%s', value should be a valid integer string" % terminal_length) + raise AnsibleConnectionFailure( + "Invalid value set for vyos terminal length '%s', value should be a valid integer string" + % terminal_length + ) def on_open_shell(self): try: -- cgit v1.2.3