Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

CORTX-30751: Codacy code cleanup (#1606) #1896

Merged
merged 3 commits into from
Aug 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions st/stob_domain_recreate_on_corruption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ MAX_RPC_MSG_SIZE=163840
TM_MIN_RECV_QUEUE_LEN=2

error() { echo "$@" >&2; stop 1; }
say() { echo "$@" | tee -a $SANDBOX_DIR/confd/m0d.log; }
say() { echo "$@" | tee -a "$SANDBOX_DIR"/confd/m0d.log; }

M0_SRC_DIR=`readlink -f $0`
M0_SRC_DIR=$(readlink -f "$0")
M0_SRC_DIR=${M0_SRC_DIR%/*/*}

. $M0_SRC_DIR/utils/functions # die, sandbox_init, report_and_exit
. "$M0_SRC_DIR"/utils/functions # die, sandbox_init, report_and_exit

## Path to the file with configuration string for confd.
CONF_FILE=$SANDBOX_DIR/confd/conf.txt
Expand All @@ -51,18 +51,18 @@ XPRT=$(m0_default_xprt)
start() {
sandbox_init
_init
stub_confdb | $M0_SRC_DIR/utils/m0confgen >$CONF_FILE
stub_confdb | "$M0_SRC_DIR"/utils/m0confgen >"$CONF_FILE"
}

stop() {
local rc=${1:-$?}

trap - EXIT
_fini
if [ $rc -eq 0 ]; then
if [ "$rc" -eq 0 ]; then
sandbox_fini
else
report_and_exit stob-domain-recreate-on-corruption $rc
report_and_exit stob-domain-recreate-on-corruption "$rc"
fi
}

Expand All @@ -71,7 +71,7 @@ _init() {
if [[ "$(check_and_restart_lnet)" == "true" ]]; then
m0_modules_insert
fi
mkdir -p $SANDBOX_DIR/confd
mkdir -p "$SANDBOX_DIR"/confd
}

_fini() {
Expand Down Expand Up @@ -122,8 +122,8 @@ _mkfs() {
-m $MAX_RPC_MSG_SIZE -q $TM_MIN_RECV_QUEUE_LEN -c $CONF_FILE\
-w 3 -f $fid"

echo $M0_SRC_DIR/utils/mkfs/m0mkfs $OPTS
$M0_SRC_DIR/utils/mkfs/m0mkfs $OPTS >>$path/mkfs.log ||
echo "$M0_SRC_DIR"/utils/mkfs/m0mkfs $OPTS
"$M0_SRC_DIR"/utils/mkfs/m0mkfs $OPTS >>"$path"/mkfs.log ||
error 'm0mkfs failed'
}

Expand All @@ -133,7 +133,7 @@ trap stop EXIT

echo "Prepare"
start
cd $SANDBOX_DIR
cd "$SANDBOX_DIR"
say "mkfs"
_mkfs
say "mkfs (truncate stobs id file)"
Expand Down