Revert "Add openssh meta to add server node to known hosts"
This reverts commit 5e85528bc7c05d4bd1cab5d52744fa7281e31361.
PROD-32878
Change-Id: I79564a31734e3f68ce0a5b96aae2ba14e8b5c5d7
diff --git a/xtrabackup/files/innobackupex-client-restore-call.sh b/xtrabackup/files/innobackupex-client-restore-call.sh
index e318d5b..3adafd5 100644
--- a/xtrabackup/files/innobackupex-client-restore-call.sh
+++ b/xtrabackup/files/innobackupex-client-restore-call.sh
@@ -16,9 +16,12 @@
local LOGDIR="/var/log/backups"
local scpLog="/var/log/backups/innobackupex-restore-scp.log"
mkdir -p $LOGDIR
+ echo "Adding ssh-key of remote host to known_hosts"
+ ssh-keyscan ${CLIENT_TARGET_HOST} >> ~/.ssh/known_hosts 2>&1 | >> $scpLog
echo "Calling /usr/local/bin/innobackupex-restore.sh $REMOTEBACKUPPATH and getting the backup files from remote host"
REMOTEBACKUPPATH="$(ssh xtrabackup@${CLIENT_TARGET_HOST} "/bin/bash /usr/local/bin/innobackupex-restore-call.sh ${CLIENT_RESTORE_FULL_LATEST}")"
/usr/local/bin/innobackupex-restore.sh $REMOTEBACKUPPATH
+ ssh-keygen -R ${CLIENT_TARGET_HOST} 2>&1 | > $scpLog
}
function backup_local(){
diff --git a/xtrabackup/files/innobackupex-client-runner.sh b/xtrabackup/files/innobackupex-client-runner.sh
index 7a70e2d..b287300 100644
--- a/xtrabackup/files/innobackupex-client-runner.sh
+++ b/xtrabackup/files/innobackupex-client-runner.sh
@@ -204,6 +204,11 @@
# rsync just the new or modified backup files
if [ ! -z "$SERVERBACKUPHOST" ]; then
+ echo "Adding ssh-key of remote host to known_hosts"
+ if [ -f ~/.ssh/known_hosts ]; then
+ ssh-keygen -R $SERVERBACKUPHOST 2>&1 | tee $rsyncLog
+ fi
+ ssh-keyscan $SERVERBACKUPHOST >> ~/.ssh/known_hosts 2>&1 | tee $rsyncLog
echo "Rsyncing files to remote host"
/usr/bin/rsync -rhtPpv --rsync-path=rsync --progress $BACKUPDIR/* -e ssh xtrabackup@$SERVERBACKUPHOST:$SERVERBACKUPDIR 2>&1 | tee $rsyncLog
diff --git a/xtrabackup/meta/openssh.yml b/xtrabackup/meta/openssh.yml
deleted file mode 100644
index a3e8eca..0000000
--- a/xtrabackup/meta/openssh.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-{%- from "xtrabackup/map.jinja" import client with context %}
-{%- if client.get('enabled', False) %}
-user:
- xtrabackup:
- enabled: true
- user: ${linux:system:user:xtrabackup}
- known_hosts:
- - name: {{ client.target.host }}
- type: ssh-rsa
- public_key: ${_param:backup_public_key}
-{%- endif %}
\ No newline at end of file