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.in24
1 files changed, 16 insertions, 8 deletions
diff --git a/geo-replication/src/peer_add_secret_pub.in b/geo-replication/src/peer_add_secret_pub.in
index 97011f204d2..5a9fd9ac347 100644
--- a/geo-replication/src/peer_add_secret_pub.in
+++ b/geo-replication/src/peer_add_secret_pub.in
@@ -1,18 +1,26 @@
#!/bin/bash
-if [ "$1" == "" ]; then
- user="root"
- home_dir=`getent passwd root | cut -d ':' -f 6`;
-else
- user=$1
- home_dir=`getent passwd $1 | cut -d ':' -f 6`;
-fi
+user=$1
+mastervol=$2
+slavevol=$3
if [ "$user" == "" ]; then
echo "Invalid User";
exit 1;
fi
+if [ "$mastervol" == "" ]; then
+ echo "Invalid master volume";
+ exit 1;
+fi
+
+if [ "$slavevol" == "" ]; then
+ echo "Invalid slave volume";
+ exit 1;
+fi
+
+home_dir=`getent passwd $user | cut -d ':' -f 6`;
+
if [ "$home_dir" == "" ]; then
echo "Invalid home dir";
exit 1;
@@ -30,4 +38,4 @@ if [ ! -d $home_dir/.ssh/authorized_keys ]; then
chown $user: $home_dir/.ssh/authorized_keys;
fi
-cat "$GLUSTERD_WORKDIR"/geo-replication/common_secret.pem.pub >> $home_dir/.ssh/authorized_keys;
+cat "$GLUSTERD_WORKDIR"/geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub >> $home_dir/.ssh/authorized_keys;