summaryrefslogtreecommitdiffstats
path: root/geo-replication/src/set_geo_rep_pem_keys.sh
diff options
context:
space:
mode:
Diffstat (limited to 'geo-replication/src/set_geo_rep_pem_keys.sh')
-rwxr-xr-xgeo-replication/src/set_geo_rep_pem_keys.sh25
1 files changed, 21 insertions, 4 deletions
diff --git a/geo-replication/src/set_geo_rep_pem_keys.sh b/geo-replication/src/set_geo_rep_pem_keys.sh
index 7b825693fad..8a43fa39d1f 100755
--- a/geo-replication/src/set_geo_rep_pem_keys.sh
+++ b/geo-replication/src/set_geo_rep_pem_keys.sh
@@ -10,11 +10,27 @@
function main()
{
user=$1
+ master_vol=$2
+ slave_vol=$3
+ GLUSTERD_WORKDIR=$(gluster system:: getwd)
+
if [ "$user" == "" ]; then
echo "Please enter the user's name"
exit 1;
fi
+ if [ "$master_vol" == "" ]; then
+ echo "Invalid master volume name"
+ exit 1;
+ fi
+
+ if [ "$slave_vol" == "" ]; then
+ echo "Invalid slave volume name"
+ exit 1;
+ fi
+
+ COMMON_SECRET_PEM_PUB=${master_vol}_${slave_vol}_common_secret.pem.pub
+
if [ "$user" == "root" ]; then
echo "This script is not needed for root"
exit 1;
@@ -27,10 +43,11 @@ function main()
exit 1;
fi
- if [ -f $home_dir/common_secret.pem.pub ]; then
- cp $home_dir/common_secret.pem.pub ${GLUSTERD_WORKDIR}/geo-replication/
- gluster system:: copy file /geo-replication/common_secret.pem.pub
- gluster system:: execute add_secret_pub $user
+ if [ -f $home_dir/${COMMON_SECRET_PEM_PUB} ]; then
+ cp $home_dir/${COMMON_SECRET_PEM_PUB} ${GLUSTERD_WORKDIR}/geo-replication/
+ gluster system:: copy file /geo-replication/${COMMON_SECRET_PEM_PUB}
+ gluster system:: execute add_secret_pub $user geo-replication/${master_vol}_${slave_vol}_common_secret.pem.pub
+ gluster vol set ${slave_vol} features.read-only on
else
echo "$home_dir/common_secret.pem.pub not present. Please run geo-replication command on master with push-pem option to generate the file"
exit 1;