summaryrefslogtreecommitdiffstats
path: root/geo-replication/src/peer_add_secret_pub.in
diff options
context:
space:
mode:
Diffstat (limited to 'geo-replication/src/peer_add_secret_pub.in')
-rw-r--r--geo-replication/src/peer_add_secret_pub.in11
1 files changed, 9 insertions, 2 deletions
diff --git a/geo-replication/src/peer_add_secret_pub.in b/geo-replication/src/peer_add_secret_pub.in
index a297dd09754..1fc31642c8a 100644
--- a/geo-replication/src/peer_add_secret_pub.in
+++ b/geo-replication/src/peer_add_secret_pub.in
@@ -60,5 +60,12 @@ if [ ! -d $authorized_keys_file ]; then
fi
pub_file=${mastervol}_${slavevol}_common_secret.pem.pub
-cat "$GLUSTERD_WORKDIR"/geo-replication/$pub_file >> \
- $authorized_keys_file;
+
+# Add to authorized_keys file only if not exists already
+while read line
+do
+ grep -Fxq "$line" $authorized_keys_file;
+ [ $? -ne 0 ] && echo "$line" >> $authorized_keys_file;
+done < "$GLUSTERD_WORKDIR"/geo-replication/$pub_file;
+
+exit 0;