file copy #119
Replies: 4 comments 13 replies
-
Hey @viktorkertesz, thanks for opening this! While I don't want to say I'd "never" want to add copy functionality, my initial gut feeling is its kinda a dead idea for me -- but again, not saying never! The main objections I have are:
Stuff like this is/was part of the reason I had thought it would be a good idea to keep the transports as separate repos/libraries.... then if they diverged in functionality more it wasn't as big of a deal as if they are all in the same repo w/ wildly different features. But.... maintaining all the plugin repos was more trouble than it was worth (at least at the time I suppose). One possible option to kinda get the best of all worlds could be to build a third party plugin that extends the existing asyncssh transport -- as far as I recall the plugin machinery for transports still exists in scrapli core, so all you would need to do would be to create the plugin and call it "scrapli_asyncssh2" or something (important part is starting with "scrapli_" so it can be loaded properly). Sorry for the wall of text! Let me know what ya think? Carl |
Beta Was this translation helpful? Give feedback.
-
Hey @carlmontanari , I'd need your opinion on the whole thing and also some advice if I want to implement timeout prevention. The file transfer will block all other operation at the moment and it can time out the main SSH channel. I have a workaround which enters empty commands in a specific interval during the copy, but I had to patch asyncssh for that to work. (progress_handler function call was not async but I could use that callback to handle timeout) BTW, I attached the demo code in action. result = await conn.file_transfer(operation='get', src=file_name, dst=".", overwrite=True,
force_scp_config=False, progress_handler=progress_handler) scrapli_scp.mp4 |
Beta Was this translation helpful? Give feedback.
-
Hell yeah! Ron is awesome!
I think (would have to confirm) that sending an empty string will send a newline which probably you dont want since there may be a prompt/something happening after the transfer is done/fails that you may be blindly sending a return at. This is why in that old "network keep alive" was like ctrl+e or something innocuous. I could be 100% wrong here, but figured id share what I think I remember :)
Yeah -- I honestly dont know what makes the most sense here... I think maybe Sounds good on the sync stuff and everything else, thanks for keeping this going! -- lots of good info/work you've done here, nice to have it documented in the discussions! Carl |
Beta Was this translation helpful? Give feedback.
-
Hi Carl! |
Beta Was this translation helpful? Give feedback.
-
Hi Carl, all,
I wonder if you wanted to implement file copy (aka SCP) in specific device drivers. I did a POC to make it work with asyncssh. It does work, though the implementation is a bit ugly to my eyes. We need to open a 2nd session to the device and for that I use "private" connection options.
My idea was to do similar to netmiko file copy functionality. Are you interested or it's a dead idea?
Regards,
Viktor Kertesz
Beta Was this translation helpful? Give feedback.
All reactions