From 242fce43699f29dfb2397e6977d5f112ae87e83c Mon Sep 17 00:00:00 2001 From: alfhad Date: Thu, 23 Jun 2022 01:20:05 +0530 Subject: [PATCH] CORTX-30751: Codacy code cleanup (#1606) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: alfhad --- spiel/st/m0t1fs_spiel_sns_repair.sh | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/spiel/st/m0t1fs_spiel_sns_repair.sh b/spiel/st/m0t1fs_spiel_sns_repair.sh index 59c122cb727..400eb0ec775 100755 --- a/spiel/st/m0t1fs_spiel_sns_repair.sh +++ b/spiel/st/m0t1fs_spiel_sns_repair.sh @@ -22,7 +22,7 @@ M0_SRC_DIR=`readlink -f $0` M0_SRC_DIR=${M0_SRC_DIR%/*/*/*} testname="spiel-sns-repair" -. $M0_SRC_DIR/spiel/st/m0t1fs_spiel_sns_common_inc.sh +. "$M0_SRC_DIR"/spiel/st/m0t1fs_spiel_sns_common_inc.sh spiel_sns_repair_and_rebalance_test() @@ -31,12 +31,12 @@ spiel_sns_repair_and_rebalance_test() local fail_device2=9 local fail_device3=3 - local_write $src_bs $src_count || return $? + local_write "$src_bs" "$src_count" || return $? echo "Starting SNS repair testing ..." for ((i=0; i < ${#files[*]}; i++)) ; do - touch_file $MOTR_M0T1FS_MOUNT_DIR/${files[$i]} ${unit_size[$i]} - _dd ${files[$i]} $((${unit_size[$i]} * 1024)) ${file_size[$i]} + touch_file "$MOTR_M0T1FS_MOUNT_DIR"/"${files[$i]}" "${unit_size[$i]}" + _dd "${files[$i]}" $((${unit_size[$i]} * 1024)) "${file_size[$i]}" done verify || return $? @@ -132,9 +132,9 @@ test_repaired_device_failure() { local fail_device1=$1 - disk_state_get $fail_device1 || return $? + disk_state_get "$fail_device1" || return $? - disk_state_set "rebalance" $fail_device1 || return $? + disk_state_set "rebalance" "$fail_device1" || return $? echo "Starting SNS Rebalance.." spiel_sns_rebalance_start @@ -142,11 +142,11 @@ test_repaired_device_failure() spiel_wait_for_sns_rebalance || return $? sleep 2 - disk_state_set "online" $fail_device1 || return $? + disk_state_set "online" "$fail_device1" || return $? echo "SNS Rebalance done." verify || return $? - disk_state_get $fail_device1 || return $? + disk_state_get "$fail_device1" || return $? } test_new_device_failure() @@ -155,8 +155,8 @@ test_new_device_failure() local fail_device2=$2 echo "Set $fail_device2 to "failed"" - disk_state_set "failed" $fail_device2 || return $? - disk_state_set "repair" $fail_device2 || return $? + disk_state_set "failed" "$fail_device2" || return $? + disk_state_set "repair" "$fail_device2" || return $? echo "Start SNS repair again" spiel_sns_repair_start @@ -166,11 +166,11 @@ test_new_device_failure() spiel_wait_for_sns_repair || return $? verify || return $? - disk_state_set "repaired" $fail_device2 || return $? + disk_state_set "repaired" "$fail_device2" || return $? - disk_state_get $fail_device1 $fail_device2 || return $? + disk_state_get "$fail_device1" "$fail_device2" || return $? - disk_state_set "rebalance" $fail_device1 $fail_device2 || return $? + disk_state_set "rebalance" "$fail_device1" "$fail_device2" || return $? echo "Starting SNS Rebalance.." spiel_sns_rebalance_start @@ -178,11 +178,11 @@ test_new_device_failure() spiel_wait_for_sns_rebalance || return $? sleep 2 - disk_state_set "online" $fail_device1 $fail_device2 || return $? + disk_state_set "online" "$fail_device1" "$fail_device2" || return $? echo "SNS Rebalance done." verify || return $? - disk_state_get $fail_device1 $fail_device2 || return $? + disk_state_get "$fail_device1" "$fail_device2" || return $? } rebalance_abort() @@ -191,23 +191,23 @@ rebalance_abort() local fail_device2=$2 echo "Set Failure device: $fail_device1" - disk_state_set "failed" $fail_device1 || return $? + disk_state_set "failed" "$fail_device1" || return $? echo "Start SNS repair." echo "set $fail_device1 to repairing" - disk_state_set "repair" $fail_device1 || return $? + disk_state_set "repair" "$fail_device1" || return $? spiel_sns_repair_start sleep 2 echo "wait for sns repair to finish." spiel_wait_for_sns_repair || return $? - disk_state_set "repaired" $fail_device1 || return $? + disk_state_set "repaired" "$fail_device1" || return $? echo "SNS Repair done." verify || return $? - disk_state_set "rebalance" $fail_device1 || return $? - disk_state_get $fail_device1 || return $? + disk_state_set "rebalance" "$fail_device1" || return $? + disk_state_get "$fail_device1" || return $? sleep 2 echo "Starting SNS Re-balance.." spiel_sns_rebalance_start @@ -218,12 +218,12 @@ rebalance_abort() spiel_wait_for_sns_rebalance || return $? echo "Set $fail_device1 back to "repaired"" - disk_state_set "repaired" $fail_device1 || return $? - if [ $fail_device1 -eq $fail_device2 ] + disk_state_set "repaired" "$fail_device1" || return $? + if [ "$fail_device1" -eq "$fail_device2" ] then - test_repaired_device_failure $fail_device1 + test_repaired_device_failure "$fail_device1" else - test_new_device_failure $fail_device1 $fail_device2 + test_new_device_failure "$fail_device1" "$fail_device2" fi } @@ -252,7 +252,7 @@ main() spiel_cleanup echo "unmounting and cleaning.." - unmount_and_clean &>> $MOTR_TEST_LOGFILE + unmount_and_clean &>> "$MOTR_TEST_LOGFILE" motr_service stop || { echo "Failed to stop Motr Service."