Fix bashate errors

Change-Id: I0bc91817787a95a04eb3f951e4e2067192ccd67c
This commit is contained in:
Sergey Reshetnyak 2014-10-08 18:21:49 +04:00
parent 83cfb81c32
commit e5bf36f5ce
8 changed files with 97 additions and 109 deletions

View File

@ -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
done

View File

@ -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
done

View File

@ -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
done

View File

@ -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
done

View File

@ -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
done

View File

@ -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

View File

@ -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

View File

@ -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