Fix IOS remote file copy credentials and report device copy errors - #429
Open
mattmiller87 wants to merge 2 commits into
Open
mattmiller87 wants to merge 2 commits into
mattmiller87 wants to merge 2 commits into
Conversation
mattmiller87
requested review from
jeffkala,
pke11y and
pszulczewski
as code owners
September 17, 2026 15:32
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.
Summary
FTP transfers to Cisco IOS devices never authenticated.
FileCopyModel.__post_init__strips credentials out of the download URL (pyntc/utils/models.py:88-90), and the IOS driver sent that stripped URL to the device. It relied on answeringSource usernameandPasswordprompts instead. IOS does not issue those prompts forcopy ftp:. The device attempted an anonymous login, the server refused it, and the transfer failed in under half a second.The failure was reported through a Nautobot OS upgrade workflow, which surfaced this:
What Changed
Two commits, because these are two separate defects:
Fix IOS remote file copy dropping URL credentialsis the reported bug.Report the device error when a remote file copy failsimproved logging across four drivers.Changes by driver
Repurposed existing methods to make all drivers consistent
_netloc,_source_path,_build_url_copy_command_*nxos_device.py:413-438for/elseguard on the prompt loopasa_device.py:1110-1123eos_device.py:633-637jnpr_device.py:1829or ""on the prompt answersnxos_device.py:596-597ios_device.pygets the credential routing, the prompt-answer defaults, the error detail and the loop guard.nxos_device.py,asa_device.pyandiosxr_device.pyget the error detail only, plus the loop guard where they lacked one. ASA and IOS-XR already logged the device output and then threw it away at the exception.Testing
The driver was run end to end against a live device, a WS-C3650-48PQ running IOS-XE 16.12.14.
Fifteen new unit tests cover the IOS credential routing, the non-default port, the VRF token, the error detail and the loop guard. The error and loop-guard tests are mirrored on NX-OS, ASA and IOS-XR.
tests/integration/test_ios_device.pyis new and skips unless its URL environment variables are set, so it runs against a lab device on demand and never in CI.Follow-ups, not in this PR
FileCopyModel.ftp_passivedoes nothing outside the Junos driver. IOS defaults to active FTP and would needip ftp passivein global config.