Browse Source

chg: [0km] use new ``ssh-key`` api ``get-type`` to discover type of backup

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
rc1
Valentin Lab 3 years ago
parent
commit
a32c5f9a43
  1. 17
      bin/0km

17
bin/0km

@ -842,25 +842,18 @@ cmdline.spec:vps-backup:cmd:recover:run() {
admin=${BACKUP_TARGET%%@*}
server=${BACKUP_TARGET#*@}
## XXXvlab: in this first implementation we expect to have access
## to the server main ssh port 22, so we won't use the provided port.
# ssh_options=()
ssh_options=()
if [[ "$server" == *":"* ]]; then
# ssh_options+=(-p "${server#*:}")
ssh_options+=(-p "${server#*:}")
ssh_server=${server%%:*}
fi
BACKUP_PATH="/srv/datastore/data/rsync-backup-target/var/mirror"
if ! rtype=$(echo "
if [ -d '$BACKUP_PATH/$id/var/lib/docker/volumes/mailcowdockerized_crypt-vol-1' ]; then
echo mailcow
elif [ -d '$BACKUP_PATH/$id/compose.yml' ]; then
echo compose
fi
true
" | ssh:run "root@${ssh_server}" -- bash ); then
if ! rtype=$(ssh:run "$admin"@"${ssh_server}" "${ssh_options[@]}" -- ssh-key get-type "$id" ); then
err "Could not get backup type."
echo " Do you have admin access to $admin@$server ?" >&2
echo " Are you sure '$id' backup identifier belongs to '$admin' admin on '$server' ?" >&2
return 1
fi

Loading…
Cancel
Save