-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
@@ -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): |
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""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): |
There was a problem hiding this comment.
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
We have decided to instead run these through nornir-nautobot via a dispatcher method instead, so I'm going to close this PR. |
creating a PR from this so I can comment.