mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-08 11:52:32 +01:00
borg: fix connection test when remote dir exists
When testing the connection via ssh forced command, if the remote path is an empty directory (instead of nonexistent), the handler bails even tough the connection is successful. Co-authored-by: Emil Breiner <emil.breinr@krumedia.com>
This commit is contained in:
parent
69df0f16f6
commit
fe8778618f
@ -106,14 +106,13 @@ if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq
|
||||
teststr="borg list --show-rc -v $execstr_repository"
|
||||
debug "$teststr"
|
||||
output=`su -c "$teststr" 2>&1`
|
||||
if echo "$output" | grep "terminating with success status" ; then
|
||||
if echo "$output" | grep "terminating with success status" \
|
||||
|| echo "$output" | grep "^\S\+ is not a valid repository." \
|
||||
|| echo "$output" | grep "^Repository \S\+ does not exist."; then
|
||||
debug "Connected to $host as $user successfully (forced command)"
|
||||
else
|
||||
if echo "$output" | grep -E "Repository.+does not exist" ; then
|
||||
debug "Connected to $host as $user successfully (forced command)"
|
||||
else
|
||||
fatal "Can't connect to $host as $user."
|
||||
fi
|
||||
error $output
|
||||
fatal "Can't connect to $host as $user."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user