Fixed an oopsie with $ssh->error

This commit is contained in:
Matthew Connelly 2015-09-05 16:22:29 +01:00
parent 2969027dbd
commit ce2dedab7a
1 changed files with 2 additions and 2 deletions

View File

@ -40,9 +40,9 @@ sub scp_upload {
} catch {
logger(2,"SSH connection failed (exception): $_") and return 0;
};
logger(2,"SSH connection failed (error): ".$ssh->error) and return 0 if $ssh->error;
logger(2,"SSH connection failed (error): ".$ssh->error()) and return 0 if $ssh->error;
$ssh->auth_publickey($Conf->{'upload'}->{user},$Conf->{'upload'}->{sshkeypath}.'.pub',$Conf->{'upload'}->{sshkeypath});
logger(2,"SSH connection failed (auth error): ".$ssh->error) and return 0 unless $ssh->auth_ok;
logger(2,"SSH connection failed (auth error): ".$ssh->error()) and return 0 unless $ssh->auth_ok;
$Conf->{'upload'}->{remotepath} .= "/" unless $Conf->{'upload'}->{remotepath} =~ /\/$/;
logger(2,"File upload failed: ".$ssh->error) and return 0 unless $ssh->scp_put("$file",$Conf->{'upload'}->{remotepath}.$file->basename);
$ssh->disconnect; return 1;