Fix cluster script to handle "only" default shard 26/73326/3
authorLuis Gomez <ecelgp@gmail.com>
Thu, 21 Jun 2018 19:52:02 +0000 (12:52 -0700)
committerLuis Gomez <ecelgp@gmail.com>
Thu, 21 Jun 2018 20:08:05 +0000 (13:08 -0700)
This is when custom_shard_config.txt is empty.

Change-Id: I61f07071dbe2d08a004ee53183ae976c4b343883
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
karaf/src/main/assembly/bin/configure_cluster.sh

index 5607767eed05a299abf1d45f4363638a0547196c..c3f1a430e0cd7b58d978a31452296e4f4e85d2e5 100755 (executable)
@@ -108,8 +108,13 @@ function modules_builder
         count=$[count + 1]
     done
 
-    # using ::-1 below to remove the extra comma we get from the above loop
-    echo -e ${modules_string::-1}"\n]"
+    if [ ${count} == 1 ]; then
+        # if no modules found in custom_shard_config.txt just close the bracket
+        echo -e ${modules_string}"\n]"
+    else
+        # using ::-1 below to remove the extra comma we get from the above loop
+        echo -e ${modules_string::-1}"\n]"
+    fi
 }
 
 function get_cli_params