diff options
author | Ganesh B Nalawade <ganesh634@gmail.com> | 2020-03-05 12:42:32 +0530 |
---|---|---|
committer | Ganesh B Nalawade <ganesh634@gmail.com> | 2020-03-05 12:42:32 +0530 |
commit | 5434bff093240ad64f6c41c5aabed7a67631ccc6 (patch) | |
tree | 19f11079e7e60eaa4e33027f24d746720ee596ca /plugins/terminal | |
parent | 451761d89e3c523317faf5e8e58f2b51d3c68572 (diff) | |
download | vyos-ansible-old-5434bff093240ad64f6c41c5aabed7a67631ccc6.tar.gz vyos-ansible-old-5434bff093240ad64f6c41c5aabed7a67631ccc6.zip |
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
Diffstat (limited to 'plugins/terminal')
-rw-r--r-- | plugins/terminal/vyos.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/terminal/vyos.py b/plugins/terminal/vyos.py index fe7712f..8283927 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: |