-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update cnos.py #16
Update cnos.py #16
Conversation
Can you please rebase your branch, that should fix the CI failure. |
Added "no logging terminal" after log in.
6b3928c
to
6c07333
Compare
Fix backslash error.
Also, please add a changelog fragment. |
Hi, I've done a rebase and fixed a minor syntax error. Now the shippable tests pass. I've also added a changelog fragment. Thank you, |
@amuraleedhar @dkasberg as maintainers of the CNOS Ansible modules could you please take a look at this? |
I am no longer working with Lenovo. Lenovo has closed down its networking division. Dave Kasberg is long retired and is leading an intersting life outside software. I am currently employed with Cisco and wont be able to take care of this. I still admire and will be proud to be part of Ansible family.
@amuraleedhar
Sent from Yahoo Mail on Android
On Thu, Jul 9, 2020 at 22:59, John R Barker<[email protected]> wrote:
@amuraleedhar @dkasberg as maintainers of the CNOS Ansible modules could you please take a look at this?
Thanks in advance
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@gundalow Thanks, |
Co-authored-by: Felix Fontein <[email protected]>
Background ansible-collections#16 (comment)
@amuraleedhar Anil, it's been a pleasure to work with you over the years. I wish you all the success at Cisco. FYI your GitHub provile still mentions Lenovo @dkasberg Not sure if you'll see this, it's also been great working with you and I wish you luck in your future adventures. @istaicu Thank you for keeping an eye on Lenovo networking. In #100 I've set you as a maintainer of these modules, so we know we can just hit merge on your PRs. Please do shout out if there is anything we can do to assist you, it's great to see that even though this isn't an active project you are still helping keep Ansible support going. |
@gundalow Thank you very much for your support. I'll keep bugging you if there are things I don't know. Thanks. |
@gundalow Can you please make Mihai Broc ( @mihaibroc ) a maintainer too? To have a backup. |
Done. Welcome to the Ansible community @mihaibroc |
* Update cnos.py Added "no logging terminal" after log in. * Update cnos.py Fix backslash error. * Create terminal_plugin_cnos_update.yml * Update changelogs/fragments/terminal_plugin_cnos_update.yml Co-authored-by: Felix Fontein <[email protected]> Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 4d4a5f6)
Background #16 (comment) (cherry picked from commit b726cd0)
Requested in #16 (comment) (cherry picked from commit b880c13)
* Update cnos.py Added "no logging terminal" after log in. * Update cnos.py Fix backslash error. * Create terminal_plugin_cnos_update.yml * Update changelogs/fragments/terminal_plugin_cnos_update.yml Co-authored-by: Felix Fontein <[email protected]> Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 4d4a5f6)
Background ansible-collections#16 (comment) (cherry picked from commit b726cd0)
Requested in ansible-collections#16 (comment) (cherry picked from commit b880c13)
Added "no logging terminal" after log in.
SUMMARY
The problem was that, when trying to do a configuration on a Lenovo switch, in some cases, a timeout would occur with the following trace:
020-03-12 10:37:26,564 p=5491 u=root n=ansible | Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ansible/utils/jsonrpc.py", line 45, in handle_request
result = rpc_method(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/ansible/plugins/cliconf/init.py", line 42, in wrapped
return func(self, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/ansible/plugins/cliconf/cnos.py", line 102, in edit_config
results.append(self.send_command(**line))
File "/usr/lib/python2.7/site-packages/ansible/plugins/cliconf/init.py", line 127, in send_command
resp = self._connection.send(**kwargs)
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/init.py", line 35, in wrapped
return func(self, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 580, in send
response = self.receive(command, prompt, answer, newline, prompt_retry_check, check_all)
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 529, in receive
data = self._ssh_shell.recv(256)
File "/usr/lib/python2.7/site-packages/paramiko/channel.py", line 665, in recv
out = self.in_buffer.read(nbytes, self.timeout)
File "/usr/lib/python2.7/site-packages/paramiko/buffered_pipe.py", line 156, in read
self._cv.wait(timeout)
File "/usr/lib64/python2.7/threading.py", line 362, in wait
_sleep(delay)
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 596, in _handle_command_timeout
raise AnsibleConnectionFailure(msg)
After investigating, found out that the timeout occurred because some logs appear in the ssh terminal session in some cases, and the function that waits for the prompt, does not recognize the prompt in the response message, unless it is found at the end of the response. But in this case, the prompt is mixed up with the log message text. (This happens, for example, when trying to raise an interface (no shut command on an interface). When this command is issued, a log message immediately appears, showing the new state of the interface.)
And because of this timeout message, a chain reaction would occur and the switch could no longer be configured (timeout => switch stuck in the current submenu, and when trying to issue other cli commands, errors appear due to incorrect prompt).
The solution is to disable logging when ansible connects to the switch. This does not affect other connections in any way because the command takes effect only for the current session. Also, you would not be able to see those log messages anyway since there is no way to access that ansible ssh session, rendering them unnecessary.
ISSUE TYPE
COMPONENT NAME
plugins/terminal/cnos.py
ADDITIONAL INFORMATION
Tested with the changes I propose and the timeout does not occur anymore. The switch configuration can be completely executed.