Skip to content

Adding file_download and file_upload #338

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

Closed
wants to merge 3 commits into from

Conversation

itdependsnetworks
Copy link
Contributor

creating a PR from this so I can comment.

@joewesch joewesch marked this pull request as draft July 22, 2025 12:41
@joewesch joewesch changed the title Adds IOS file_download Adding file_download and file_upload Jul 29, 2025
@@ -685,6 +685,109 @@ def file_copy_remote_exists(self, src, dest=None, file_system=None):
log.debug("Host %s: File %s does not already exist on remote.", self.host, src)
return False

def file_download(self, url, dest="", md5=None, file_system=None, read_timeout=2000):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just do **netmiko_kwargs too? Incase you need read_timeout_override or any of the other netmiko kwargs.

filename,
)

copy_command = f"copy {url} {file_system}{dest}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we should construct this with some validation. I'm thinking file_system would be bootflash the dest you'd have to know to do ///image.bin or //something/image.bin. Can we use Path or some other lib to try and construct this more intelligently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even more so around the colon part. Would expect bootflash:///image.bin

return self.verify_md5(filename, md5, file_system)

def file_upload(self, filename, url, file_system=None, read_timeout=2000):
"""Upload file to remote server.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Upload file to remote server.
"""Upload local file to remote server.

return True
return self.verify_md5(filename, md5, file_system)

def file_upload(self, filename, url, file_system=None, read_timeout=2000):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps same as before around **netmiko_kwargs

@joewesch
Copy link
Collaborator

We have decided to instead run these through nornir-nautobot via a dispatcher method instead, so I'm going to close this PR.

@joewesch joewesch closed this Aug 11, 2025
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.

3 participants