Skip to content
Snippets Groups Projects
Commit fe877861 authored by Jérôme Charaoui's avatar Jérôme Charaoui
Browse files

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: default avatarEmil Breiner <emil.breinr@krumedia.com>
parent 69df0f16
No related branches found
No related tags found
No related merge requests found
...@@ -106,14 +106,13 @@ if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq ...@@ -106,14 +106,13 @@ if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq
teststr="borg list --show-rc -v $execstr_repository" teststr="borg list --show-rc -v $execstr_repository"
debug "$teststr" debug "$teststr"
output=`su -c "$teststr" 2>&1` 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)" debug "Connected to $host as $user successfully (forced command)"
else else
if echo "$output" | grep -E "Repository.+does not exist" ; then error $output
debug "Connected to $host as $user successfully (forced command)" fatal "Can't connect to $host as $user."
else
fatal "Can't connect to $host as $user."
fi
fi fi
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment