Re: How to handle the RSA key fingerprint prompt message?

Nice that you have already opened a support case for this. It's too early to say, but I feel this may end up to be a bug. I suspect that the variable $scp_username is not being evaluated properly and the entrie string "admin\ryes" is stored in the variable as username. That is just my guess though.

Ran into this issue, found this thread searching for solution. Support helped identify solution. Replying to this thread for the benefit of others.

Basically send_command has an optional parameter where you can tell it to expect a different prompt/result from the command. You can then use another to answer that prompt.

Below is a tiny/simple sample perl script that will work for SFTPing a file to Nexus switch.

# BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
# ($Vendor eq "Cisco" and $SysDescr like /NX-OS/)
#
# END-SCRIPT-BLOCK
# these variables you should be able to use as they are
use strict;
use warnings;
use NetMRI_Easy;
my $easy = new NetMRI_Easy({ api_version => 3.0 });
# you'll need to modify the values given to these variables so they match your test environment:
my $sftp_user = "username";
my $sftp_server = "ip_address";
my $target_path = "/directory/filename.bin";
my $sftp_password = "password";
# do the copy
$easy->send_command("clear ssh hosts"); # Ensures consistency between switches regardless of SSH/SFTP/SCP history (makes sure the "are you sure" prompt always shows up).
$easy->send_command("copy sftp://$sftp_user\@$sftp_server$target_path bootflash: vrf default","Are you sure you want to continue connecting (yes/no)?"); # issue copy command
$easy->send_command("yes","password:"); #answer the "are you sure" prompt
$easy->send_async_command("$sftp_password",10); # answer the password prompt, and the copy then begins
# unless we tune a custom COPP - the actual copy will always take too long to wait for, short timeout for async command is so we're not sitting around waiting# (but it takes more than 10 seconds to timeout, so maybe this value is below some minimum allowed)