diff --git a/sahara/plugins/hdp/versions/version_1_3_2/resources/topology.sh b/sahara/plugins/hdp/versions/version_1_3_2/resources/topology.sh index b8f2d66d..c34a0cf2 100755 --- a/sahara/plugins/hdp/versions/version_1_3_2/resources/topology.sh +++ b/sahara/plugins/hdp/versions/version_1_3_2/resources/topology.sh @@ -2,19 +2,20 @@ HADOOP_CONF=/etc/hadoop/conf while [ $# -gt 0 ] ; do - nodeArg=$1 - exec< ${HADOOP_CONF}/topology.data - result="" - while read line ; do - ar=( $line ) - if [ "${ar[0]}" = "$nodeArg" ] ; then - result="${ar[1]}" + nodeArg=$1 + exec< ${HADOOP_CONF}/topology.data + result="" + while read line ; do + ar=( $line ) + if [ "${ar[0]}" = "$nodeArg" ] ; then + result="${ar[1]}" + fi + done + shift + if [ -z "$result" ] ; then + echo -n "/default/rack " + else + echo -n "$result " fi - done - shift - if [ -z "$result" ] ; then - echo -n "/default/rack " - else - echo -n "$result " - fi -done \ No newline at end of file +done + diff --git a/sahara/plugins/hdp/versions/version_2_0_6/resources/topology.sh b/sahara/plugins/hdp/versions/version_2_0_6/resources/topology.sh index b8f2d66d..c34a0cf2 100755 --- a/sahara/plugins/hdp/versions/version_2_0_6/resources/topology.sh +++ b/sahara/plugins/hdp/versions/version_2_0_6/resources/topology.sh @@ -2,19 +2,20 @@ HADOOP_CONF=/etc/hadoop/conf while [ $# -gt 0 ] ; do - nodeArg=$1 - exec< ${HADOOP_CONF}/topology.data - result="" - while read line ; do - ar=( $line ) - if [ "${ar[0]}" = "$nodeArg" ] ; then - result="${ar[1]}" + nodeArg=$1 + exec< ${HADOOP_CONF}/topology.data + result="" + while read line ; do + ar=( $line ) + if [ "${ar[0]}" = "$nodeArg" ] ; then + result="${ar[1]}" + fi + done + shift + if [ -z "$result" ] ; then + echo -n "/default/rack " + else + echo -n "$result " fi - done - shift - if [ -z "$result" ] ; then - echo -n "/default/rack " - else - echo -n "$result " - fi -done \ No newline at end of file +done + diff --git a/sahara/plugins/spark/resources/topology.sh b/sahara/plugins/spark/resources/topology.sh index 84838752..405af154 100644 --- a/sahara/plugins/spark/resources/topology.sh +++ b/sahara/plugins/spark/resources/topology.sh @@ -2,19 +2,20 @@ HADOOP_CONF=/etc/hadoop while [ $# -gt 0 ] ; do - nodeArg=$1 - exec< ${HADOOP_CONF}/topology.data - result="" - while read line ; do - ar=( $line ) - if [ "${ar[0]}" = "$nodeArg" ] ; then - result="${ar[1]}" + nodeArg=$1 + exec< ${HADOOP_CONF}/topology.data + result="" + while read line ; do + ar=( $line ) + if [ "${ar[0]}" = "$nodeArg" ] ; then + result="${ar[1]}" + fi + done + shift + if [ -z "$result" ] ; then + echo -n "/default/rack " + else + echo -n "$result " fi - done - shift - if [ -z "$result" ] ; then - echo -n "/default/rack " - else - echo -n "$result " - fi -done \ No newline at end of file +done + diff --git a/sahara/plugins/vanilla/hadoop2/resources/topology.sh b/sahara/plugins/vanilla/hadoop2/resources/topology.sh index 658b3b47..1586d4b6 100755 --- a/sahara/plugins/vanilla/hadoop2/resources/topology.sh +++ b/sahara/plugins/vanilla/hadoop2/resources/topology.sh @@ -2,19 +2,20 @@ HADOOP_CONF=/opt/hadoop/etc/hadoop while [ $# -gt 0 ] ; do - nodeArg=$1 - exec< ${HADOOP_CONF}/topology.data - result="" - while read line ; do - ar=( $line ) - if [ "${ar[0]}" = "$nodeArg" ] ; then - result="${ar[1]}" + nodeArg=$1 + exec< ${HADOOP_CONF}/topology.data + result="" + while read line ; do + ar=( $line ) + if [ "${ar[0]}" = "$nodeArg" ] ; then + result="${ar[1]}" + fi + done + shift + if [ -z "$result" ] ; then + echo -n "/default/rack " + else + echo -n "$result " fi - done - shift - if [ -z "$result" ] ; then - echo -n "/default/rack " - else - echo -n "$result " - fi -done \ No newline at end of file +done + diff --git a/sahara/plugins/vanilla/v1_2_1/resources/topology.sh b/sahara/plugins/vanilla/v1_2_1/resources/topology.sh index 84838752..405af154 100755 --- a/sahara/plugins/vanilla/v1_2_1/resources/topology.sh +++ b/sahara/plugins/vanilla/v1_2_1/resources/topology.sh @@ -2,19 +2,20 @@ HADOOP_CONF=/etc/hadoop while [ $# -gt 0 ] ; do - nodeArg=$1 - exec< ${HADOOP_CONF}/topology.data - result="" - while read line ; do - ar=( $line ) - if [ "${ar[0]}" = "$nodeArg" ] ; then - result="${ar[1]}" + nodeArg=$1 + exec< ${HADOOP_CONF}/topology.data + result="" + while read line ; do + ar=( $line ) + if [ "${ar[0]}" = "$nodeArg" ] ; then + result="${ar[1]}" + fi + done + shift + if [ -z "$result" ] ; then + echo -n "/default/rack " + else + echo -n "$result " fi - done - shift - if [ -z "$result" ] ; then - echo -n "/default/rack " - else - echo -n "$result " - fi -done \ No newline at end of file +done + diff --git a/sahara/tests/integration/tests/resources/cluster_config_test_script.sh b/sahara/tests/integration/tests/resources/cluster_config_test_script.sh index 4a1319e3..452f44da 100644 --- a/sahara/tests/integration/tests/resources/cluster_config_test_script.sh +++ b/sahara/tests/integration/tests/resources/cluster_config_test_script.sh @@ -45,8 +45,7 @@ case $1 in esac shift -if [ "$1" = "-value" ] -then +if [ "$1" = "-value" ]; then VALUE="$2" fi shift @@ -55,8 +54,7 @@ check_submitted_parameter() { case "$1" in config_value) - if [ -z "$VALUE" ] - then + if [ -z "$VALUE" ]; then echo "Config value is not specified" >> $log exit 1 fi @@ -68,8 +66,7 @@ compare_config_values() { check_submitted_parameter config_value - if [ "$VALUE" = "$1" ] - then + if [ "$VALUE" = "$1" ]; then echo -e "CHECK IS SUCCESSFUL \n\n" >> $log && exit 0 else echo -e "Config value while cluster creation request: $VALUE \n" >> $log diff --git a/sahara/tests/integration/tests/resources/map_reduce_test_script.sh b/sahara/tests/integration/tests/resources/map_reduce_test_script.sh index f8c42e62..ddb9e83d 100644 --- a/sahara/tests/integration/tests/resources/map_reduce_test_script.sh +++ b/sahara/tests/integration/tests/resources/map_reduce_test_script.sh @@ -28,8 +28,7 @@ case $1 in esac shift -if [ "$1" = "-job_name" ] -then +if [ "$1" = "-job_name" ]; then JOB_NAME="$2" fi shift @@ -38,8 +37,7 @@ check_submitted_parameter() { case "$1" in job_name) - if [ -z "$JOB_NAME" ] - then + if [ -z "$JOB_NAME" ]; then echo "Job name not specified" exit 1 fi @@ -52,8 +50,7 @@ check_job_directory_existence() { check_submitted_parameter job_name app_name=${JOB_NAME/"job"/"application"} - if ! [ -d $HADOOP_LOG_DIRECTORY/$JOB_NAME -o -d $HADOOP_LOG_DIRECTORY/$app_name ] - then + if ! [ -d $HADOOP_LOG_DIRECTORY/$JOB_NAME -o -d $HADOOP_LOG_DIRECTORY/$app_name ]; then echo "Log file of \"PI\" job not found" exit 1 fi @@ -61,8 +58,7 @@ check_job_directory_existence() { create_log_directory() { - if ! [ -d $dir ] - then + if ! [ -d $dir ]; then mkdir $dir chmod -R 777 $dir touch $log @@ -91,8 +87,7 @@ get_pi_job_name() { job_name=`sudo -u $HADOOP_USER bash -lc "hadoop job -list all | grep '^[[:space:]]*job_' | sort | tail -n1" | awk '{print $1}'` - if [ $job_name = "JobId" ] - then + if [ $job_name = "JobId" ]; then echo "\"PI\" job name has not been obtained since \"PI\" job was not launched" >> $log exit 1 fi @@ -102,18 +97,14 @@ get_pi_job_name() { check_return_code_after_command_execution() { - if [ "$1" = "-exit" ] - then - if [ "$2" -ne 0 ] - then + if [ "$1" = "-exit" ]; then + if [ "$2" -ne 0 ]; then exit 1 fi fi - if [ "$1" = "-clean_hdfs" ] - then - if [ "$2" -ne 0 ] - then + if [ "$1" = "-clean_hdfs" ]; then + if [ "$2" -ne 0 ]; then sudo -u $HADOOP_USER bash -lc "hadoop dfs -rmr /map-reduce-test" && exit 1 fi fi diff --git a/sahara/tests/integration/tests/resources/swift_test_script.sh b/sahara/tests/integration/tests/resources/swift_test_script.sh index 5edfb5fd..af5f1e59 100644 --- a/sahara/tests/integration/tests/resources/swift_test_script.sh +++ b/sahara/tests/integration/tests/resources/swift_test_script.sh @@ -13,8 +13,7 @@ compare_files() { a=`md5sum $1 | awk {'print \$1'}` b=`md5sum $2 | awk {'print \$1'}` - if [ "$a" = "$b" ] - then + if [ "$a" = "$b" ]; then echo "md5-sums of files $1 and $2 are equal" else echo -e "\nUpload file to Swift: $1 \n" @@ -26,18 +25,14 @@ compare_files() { check_return_code_after_command_execution() { - if [ "$1" = "-exit" ] - then - if [ "$2" -ne 0 ] - then + if [ "$1" = "-exit" ]; then + if [ "$2" -ne 0 ]; then exit 1 fi fi - if [ "$1" = "-clean_hdfs" ] - then - if [ "$2" -ne 0 ] - then + if [ "$1" = "-clean_hdfs" ]; then + if [ "$2" -ne 0 ]; then sudo -u $HADOOP_USER bash -lc "hadoop dfs -rmr /swift-test" && exit 1 fi fi