changed log output regarding empty password

This commit is contained in:
Daniel Sommer 2023-09-07 15:51:53 +02:00
parent 9ef9354b68
commit 5eab61d350
2 changed files with 4 additions and 5 deletions

View file

@ -14,7 +14,10 @@ func main() {
log.Info("starting gosync...") log.Info("starting gosync...")
error := tools.TestConnection() error := tools.TestConnection()
if error != nil { if error != nil {
log.Fatal("encountered an error connecting to the remove target", error.Error()) if len(settings.Password) == 0 {
log.Warning("could not connect to the remote target, make sure passwordless login is configured or supply a password")
}
log.Fatal("encountered an error connecting to the remote target", error.Error())
} }
tools.Transfer() tools.Transfer()
exit(timestamp, 0) exit(timestamp, 0)

View file

@ -6,7 +6,6 @@ import (
"os/exec" "os/exec"
"strings" "strings"
"velvettear/gosync/log"
"velvettear/gosync/settings" "velvettear/gosync/settings"
) )
@ -15,9 +14,6 @@ func TestConnection() error {
if !settings.TargetIsRemote() { if !settings.TargetIsRemote() {
return nil return nil
} }
if len(settings.Password) == 0 {
log.Warning("target is a remote host and no password is set, make sure passwordless login is configured")
}
var arguments []string var arguments []string
if len(settings.Password) > 0 { if len(settings.Password) > 0 {
arguments = append(arguments, "-p", settings.Password) arguments = append(arguments, "-p", settings.Password)