Bug Fix NXOS#387
Open
mattmiller87 wants to merge 6 commits into
Open
Conversation
4864906 to
428cfa6
Compare
428cfa6 to
b4a3f78
Compare
cacc60c to
9b5c676
Compare
498d9d1 to
aa6a1cc
Compare
aa6a1cc to
87fbf1e
Compare
gsnider2195
reviewed
May 18, 2026
| FileSystemNotFoundError: When the module is unable to determine the default file system. | ||
| """ | ||
| raw_data = self.show("dir", raw_text=True) | ||
| self.open() |
Contributor
There was a problem hiding this comment.
Why are we calling self.open() in seemingly random places? Is this working around timeouts not being handled correctly?
Contributor
There was a problem hiding this comment.
Netmiko seems to be handling this fine so I'm going to remove these redundant self.open() calls:
>>> nxos.check_file_exists("system.bin")
2026-05-18 15:34:01,174 [ERROR] paramiko.transport: Socket exception: Connection reset by peer (104)
2026-05-18 15:34:03,854 [INFO] paramiko.transport: Connected (version 2.0, client OpenSSH_6.2)
2026-05-18 15:34:04,476 [INFO] paramiko.transport: Auth banner: b'C\ntest banner\n'
2026-05-18 15:34:04,476 [INFO] paramiko.transport: Authentication (password) successful!
gsnider2195
reviewed
May 18, 2026
| import unittest | ||
|
|
||
| import mock | ||
| from hypothesis import given |
Contributor
There was a problem hiding this comment.
In a prior PR I asked that we stick with testing patterns that the team is familiar with. Please remove hypothesis.
gsnider2195
requested changes
May 18, 2026
Contributor
gsnider2195
left a comment
There was a problem hiding this comment.
We need to address some feedback before merging this
Contributor
|
Tested the updated commands against a device in the lab: |
gsnider2195
reviewed
May 18, 2026
| def test_get_free_space_raises_on_parse_error(self): | ||
| """Test _get_free_space raises CommandError when output can't be parsed.""" | ||
| mock_show.return_value = "Directory of bootflash:/\nNo free space info here\n" | ||
| self.device.native_ssh.send_command.return_value = "Directory of bootflash:/\nNo free space info here\n" |
Contributor
There was a problem hiding this comment.
"Directory of ..." is an IOS command output but is fine for this test.
gsnider2195
approved these changes
May 18, 2026
This file contains hidden or 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
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.
New Pull Request
I am solving three bugs when running
nxos_device.py:nativeinstead ofnative_sshChange Notes
Fixed
_build_url_copy_command_simpleto return a string.Fixed
_get_file_systemand_get_free_spaceto use native_ssh; initial intent when created.Fixed the
remote_file_copyprompts to detect needing to enter a vrf if one isn't provided.Justification
The copy command return from
_build_url_copy_command_simpleshould not be a tuple.remote_file_copymethod is using native_ssh and _get_file_systemand_get_free_spaceshould be using it too.remote_file_copy` may return a prompt we were not catching previously.Note: unittest changes were written with AI