-
Notifications
You must be signed in to change notification settings - Fork 105
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
network_cli libssh: prevent data to appear multiple times in output #517
Closed
felixfontein
wants to merge
2
commits into
ansible-collections:main
from
felixfontein:network_cli-libssh
Closed
network_cli libssh: prevent data to appear multiple times in output #517
felixfontein
wants to merge
2
commits into
ansible-collections:main
from
felixfontein:network_cli-libssh
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ponse. Right now resp is extended by newly read data every time, but resp is never truncated after sanitized resp is added to self._command_response. This causes the same data being added multiple times to self._command_response depending on how often the prompt is identified in the result.
for more information, see https://pre-commit.ci
The failures seem to be unrelated to the PR, since they fail everywhere else as well, for example in #515. |
I'm going to close this in favor of #521 as that replicates the paramiko behavior more closely. Also tests! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Prevent the same data being added multiple times to
self._command_response
.Right now
resp
is extended by newly readdata
every time, butresp
is never truncated after sanitizedresp
is added toself._command_response
. This causes the same data being added multiple times toself._command_response
depending on how often the prompt is identified in the result. This happens for MikroTik RouterOS 7, see ansible-collections/community.routeros#132.Note that the paramiko receive method works differently, since it does
resp = self._strip(self._last_response)
before adding the sanitizedresp
toself._command_response
. This is consistent with the report in ansible-collections/community.routeros#132 that this problem does not appear with paramiko, but only with libssh.Fixes ansible-collections/community.routeros#132.
ISSUE TYPE
COMPONENT NAME
network_cli