Skip to content
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

Conversation

felixfontein
Copy link
Contributor

SUMMARY

Prevent the same data being added multiple times to self._command_response.

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. 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 sanitized resp to self._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
  • Bugfix Pull Request
COMPONENT NAME

network_cli

felixfontein and others added 2 commits February 28, 2023 22:53
…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.
@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/702749af88104d339dc61ec457814ccb

ansible-test-network-integration-junos-vsrx-netconf-python36-stable29 FAILURE in 9m 22s (non-voting)
✔️ ansible-test-network-integration-junos-vsrx-netconf-python36-stable211 SUCCESS in 1h 10m 13s
✔️ ansible-test-network-integration-junos-vsrx-netconf-python39-stable212 SUCCESS in 1h 00m 56s
✔️ ansible-test-network-integration-junos-vsrx-netconf-python39 SUCCESS in 1h 01m 17s
ansible-test-network-integration-junos-vsrx-network_cli-python36-stable29 FAILURE in 8m 59s (non-voting)
✔️ ansible-test-network-integration-junos-vsrx-network_cli-python36-stable211 SUCCESS in 14m 52s
✔️ ansible-test-network-integration-junos-vsrx-network_cli-python39-stable212 SUCCESS in 12m 12s
✔️ ansible-test-network-integration-junos-vsrx-network_cli-python39 SUCCESS in 12m 12s
ansible-test-network-integration-junos-vsrx-network_cli-libssh-python36-stable29 FAILURE in 9m 44s (non-voting)
✔️ ansible-test-network-integration-junos-vsrx-network_cli-libssh-python36-stable211 SUCCESS in 12m 53s
✔️ ansible-test-network-integration-junos-vsrx-network_cli-libssh-python39-stable212 SUCCESS in 11m 49s
✔️ ansible-test-network-integration-junos-vsrx-network_cli-libssh-python39 SUCCESS in 12m 21s
✔️ ansible-test-network-integration-nxos-cli-python39-scenario01 SUCCESS in 35m 32s (non-voting)
✔️ ansible-test-network-integration-nxos-cli-python39-scenario02 SUCCESS in 40m 08s (non-voting)
✔️ ansible-test-network-integration-nxos-cli-python39-scenario03 SUCCESS in 37m 49s (non-voting)
✔️ ansible-test-network-integration-nxos-cli-python39-scenario04 SUCCESS in 41m 35s (non-voting)
ansible-test-network-integration-eos-network_cli-python39 FAILURE in 57m 10s (non-voting)
✔️ ansible-test-network-integration-eos-httpapi-python39 SUCCESS in 44m 20s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39 FAILURE in 57m 07s (non-voting)
ansible-ee-integration-ios-latest FAILURE in 13m 13s (non-voting)
ansible-ee-integration-ios-stable-2.9 FAILURE in 12m 41s (non-voting)
ansible-ee-integration-ios-stable-2.11 FAILURE in 13m 23s (non-voting)
ansible-ee-integration-ios-stable-2.12 FAILURE in 13m 57s (non-voting)
ansible-ee-integration-ios-libssh-latest FAILURE in 42m 30s (non-voting)
ansible-ee-integration-ios-libssh-stable-2.9 FAILURE in 39m 06s (non-voting)
ansible-ee-integration-ios-libssh-stable-2.11 FAILURE in 42m 50s (non-voting)
ansible-ee-integration-ios-libssh-stable-2.12 FAILURE in 43m 38s (non-voting)
ansible-test-network-integration-vyos-paramiko-python39-devel NODE_FAILURE Node request 200-0005742861 failed in 0s
ansible-test-network-integration-vyos-paramiko-python39-stable214 NODE_FAILURE Node request 200-0005742862 failed in 0s
ansible-test-network-integration-vyos-paramiko-python39-stable213 NODE_FAILURE Node request 200-0005742863 failed in 0s
ansible-test-network-integration-vyos-paramiko-python39-stable212 NODE_FAILURE Node request 200-0005742864 failed in 0s
ansible-test-network-integration-vyos-paramiko-python36-stable29 NODE_FAILURE Node request 200-0005742865 failed in 0s (non-voting)
ansible-test-network-integration-vyos-libssh-python39-devel NODE_FAILURE Node request 200-0005742866 failed in 0s
ansible-test-network-integration-vyos-libssh-python39-stable214 NODE_FAILURE Node request 200-0005742867 failed in 0s
ansible-test-network-integration-vyos-libssh-python39-stable213 NODE_FAILURE Node request 200-0005742868 failed in 0s
ansible-test-network-integration-vyos-libssh-python39-stable212 NODE_FAILURE Node request 200-0005742869 failed in 0s
ansible-test-network-integration-vyos-libssh-python36-stable29 NODE_FAILURE Node request 200-0005742870 failed in 0s
✔️ build-ansible-collection SUCCESS in 14m 06s
✔️ ansible-test-network-integration-ansible-netcommon-junos-vsrx-netconf-python39 SUCCESS in 9m 12s
✔️ ansible-tox-linters SUCCESS in 10m 32s
✔️ ansible-galaxy-importer SUCCESS in 4m 20s

@felixfontein
Copy link
Contributor Author

The failures seem to be unrelated to the PR, since they fail everywhere else as well, for example in #515.

@Qalthos
Copy link
Collaborator

Qalthos commented Mar 1, 2023

I'm going to close this in favor of #521 as that replicates the paramiko behavior more closely. Also tests!

@Qalthos Qalthos closed this Mar 1, 2023
@felixfontein felixfontein deleted the network_cli-libssh branch March 2, 2023 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate data in stdout and facts starting with RouterOS 7.2
2 participants