Fix linters issues and enable tox/zuul linters job as gate
Fix below linters issues E001 Trailing Whitespace E003 Indent not multiple of 4 E006 Line too long E011 Then keyword is not on same line as if or elif keyword E020 Function declaration not in format ^function name {$ E040 Syntax error: syntax error near unexpected token `;' ignore cases are added in tox setup E006 Line too long E010: do not on the same line as for Story: 2003368 Task: 24427 Change-Id: I6acf64271a4e608be8bc8fa965cac4fa31e0c05b Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
parent
82e851d651
commit
fedb95ba79
@ -4,3 +4,7 @@
|
||||
jobs:
|
||||
- openstack-tox-pep8:
|
||||
voting: false
|
||||
- openstack-tox-linters
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
|
@ -14,8 +14,7 @@
|
||||
# -o /pxeboot/pxelinux.cfg/01-08-00-27-3e-f8-05 -b sda -r sda -t -c ttyS0,115200
|
||||
#
|
||||
|
||||
function usage()
|
||||
{
|
||||
function usage {
|
||||
cat >&2 <<EOF
|
||||
$0: This utility is used to generate a node-specific pxeboot.cfg file
|
||||
|
||||
@ -37,33 +36,28 @@ EOF
|
||||
|
||||
declare text_install="inst.text"
|
||||
|
||||
function generate_config()
|
||||
{
|
||||
function generate_config {
|
||||
input=$1
|
||||
output=$2
|
||||
|
||||
if [ ! -f "$input" ]
|
||||
then
|
||||
if [ ! -f "$input" ]; then
|
||||
logger --stderr -t $0 "Error: Input file $input does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -w $(dirname $output) ]
|
||||
then
|
||||
if [ ! -w $(dirname $output) ]; then
|
||||
logger --stderr -t $0 "Error: Destination directory $(dirname $output) not writeable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e $output -a ! -w $output ]
|
||||
then
|
||||
if [ -e $output -a ! -w $output ]; then
|
||||
logger --stderr -t $0 "Error: Destination file $output_file_efi exists and is not writeable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -e "s#xxxAPPEND_OPTIONSxxx#$APPEND_OPTIONS#" $input > $output
|
||||
|
||||
if [ $? -ne 0 -o ! -f $output ]
|
||||
then
|
||||
if [ $? -ne 0 -o ! -f $output ]; then
|
||||
logger --stderr -t $0 "Error: Failed to generate pxeboot file $output"
|
||||
exit 1
|
||||
fi
|
||||
@ -130,8 +124,7 @@ if [ -z "$input_file" \
|
||||
-o -z "$output_file" \
|
||||
-o -z "$output_file_efi" \
|
||||
-o -z "$boot_device" \
|
||||
-o -z "$rootfs_device" ]
|
||||
then
|
||||
-o -z "$rootfs_device" ]; then
|
||||
logger --stderr -t $0 "Error: One or more mandatory options not specified: $@"
|
||||
usage
|
||||
exit 1
|
||||
@ -139,18 +132,15 @@ fi
|
||||
|
||||
APPEND_OPTIONS="boot_device=$boot_device rootfs_device=$rootfs_device"
|
||||
|
||||
if [ -n "$text_install" ]
|
||||
then
|
||||
if [ -n "$text_install" ]; then
|
||||
APPEND_OPTIONS="$APPEND_OPTIONS $text_install"
|
||||
fi
|
||||
|
||||
if [ -n "$console" ]
|
||||
then
|
||||
if [ -n "$console" ]; then
|
||||
APPEND_OPTIONS="$APPEND_OPTIONS console=$console"
|
||||
fi
|
||||
|
||||
if [ -n "$tisnotify" ]
|
||||
then
|
||||
if [ -n "$tisnotify" ]; then
|
||||
APPEND_OPTIONS="$APPEND_OPTIONS tisnotify=$tisnotify"
|
||||
fi
|
||||
|
||||
@ -160,13 +150,11 @@ APPEND_OPTIONS="$APPEND_OPTIONS inst.gpt"
|
||||
# Add k8s support for namespaces
|
||||
APPEND_OPTIONS="$APPEND_OPTIONS user_namespace.enable=1"
|
||||
|
||||
if [ -n "$security_profile" ]
|
||||
then
|
||||
if [ -n "$security_profile" ]; then
|
||||
APPEND_OPTIONS="$APPEND_OPTIONS security_profile=$security_profile"
|
||||
fi
|
||||
|
||||
if [ -n "$kernal_extra_args" ]
|
||||
then
|
||||
if [ -n "$kernal_extra_args" ]; then
|
||||
APPEND_OPTIONS="$APPEND_OPTIONS $kernal_extra_args"
|
||||
fi
|
||||
|
||||
@ -174,8 +162,7 @@ generate_config $input_file $output_file
|
||||
|
||||
# for extended security profile UEFI boot only,
|
||||
# a tboot option will be passed to target boot option menu
|
||||
if [ "$security_profile" == "extended" -a -n "$tboot" ]
|
||||
then
|
||||
if [ "$security_profile" == "extended" -a -n "$tboot" ]; then
|
||||
APPEND_OPTIONS="$APPEND_OPTIONS tboot=$tboot"
|
||||
fi
|
||||
|
||||
|
@ -65,9 +65,9 @@ NOT_RUNNING=7
|
||||
|
||||
trap ctrl_c INT
|
||||
|
||||
function ctrl_c(){
|
||||
echo "Exiting ..."
|
||||
exit 0
|
||||
function ctrl_c {
|
||||
echo "Exiting ..."
|
||||
exit 0
|
||||
}
|
||||
|
||||
DEBUG=false
|
||||
|
@ -201,12 +201,16 @@ while true; do
|
||||
# parent process is 1. If the parent process ID is not 1 then the process in question is a child proceess
|
||||
# and we do not care about its memory usage (for the purposes of this specific script). The continue
|
||||
# statement will return us to the for-loop and begin running for the next pid.
|
||||
if [ -f "/proc/$pid/status" ] && [ "$(awk '$0 ~ "PPid:" {print $2}' /proc/"$pid"/status)" -ne "1" ]; then continue; fi
|
||||
if [ -f "/proc/$pid/status" ] && [ "$(awk '$0 ~ "PPid:" {print $2}' /proc/"$pid"/status)" -ne "1" ];then
|
||||
continue;
|
||||
fi
|
||||
|
||||
# This checks that neither rssCurrent nor pss have empty values due to a child process being generated
|
||||
# and then killed off before its values could be read. Root occasionally generates a child process of
|
||||
# one of the monitored commands so the above if-statement doesn't exclude it because the PPID is 1.
|
||||
if [ -z "$rssCurrent" ] || [ -z "$pss" ]; then continue; fi
|
||||
if [ -z "$rssCurrent" ] || [ -z "$pss" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
# Sets initial values for PSS and RSS. NA is set instead of 0 because using numbers could lead to false
|
||||
# or inaccurate information. It also previously allowed one to see when child processes were spawned.
|
||||
@ -241,12 +245,18 @@ while true; do
|
||||
# Calculates the changes in PSS and RSS usage over time. If this is the first run and there is no
|
||||
# previous value with which to compare against, delta is set to 0, where delta is the change over
|
||||
# time.
|
||||
if [ "${lastP[pid]}" = "NA" ]; then changeP[$pid]=0; deltaP=0.000;
|
||||
else changeP[pid]="$((changeP[$pid] + $pss - lastP[$pid]))"; deltaP=$(awk -v chP="${changeP[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chP/(hrs*t))*3600; exit(0)}');
|
||||
if [ "${lastP[pid]}" = "NA" ]; then
|
||||
changeP[$pid]=0; deltaP=0.000;
|
||||
else
|
||||
changeP[pid]="$((changeP[$pid] + $pss - lastP[$pid]))";
|
||||
deltaP=$(awk -v chP="${changeP[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chP/(hrs*t))*3600; exit(0)}');
|
||||
fi
|
||||
|
||||
if [ "${lastR[pid]}" = "NA" ]; then changeR[$pid]=0; deltaR=0.000;
|
||||
else changeR[pid]="$((changeR[$pid] + rss[$pid] - lastR[$pid]))"; deltaR=$(awk -v chR="${changeR[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chR/(hrs*t))*3600; exit(0)}');
|
||||
if [ "${lastR[pid]}" = "NA" ]; then
|
||||
changeR[$pid]=0; deltaR=0.000;
|
||||
else
|
||||
changeR[pid]="$((changeR[$pid] + rss[$pid] - lastR[$pid]))";
|
||||
deltaR=$(awk -v chR="${changeR[$pid]}" -v hrs="${hours}" -v t="${period}" 'BEGIN {printf "%.3f", (chR/(hrs*t))*3600; exit(0)}');
|
||||
fi
|
||||
|
||||
# The below if-else block seeks to determine gradual sustained patterns of RSS usage over time to determine if the memory usage is gradually
|
||||
@ -336,19 +346,21 @@ while true; do
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${trend[pid]}" -ge "3" ]; then pattern[pid]="${s1[pid]}"; else pattern[pid]="none"; fi # Sets the trend variable for printing if a trend exists
|
||||
|
||||
|
||||
|
||||
if [ "${trend[pid]}" -ge "3" ]; then
|
||||
pattern[pid]="${s1[pid]}";
|
||||
else
|
||||
pattern[pid]="none";
|
||||
fi # Sets the trend variable for printing if a trend exists
|
||||
printf "\n%15s | %8s | %2s | %10s | %8s kB/h | %8s | %8s | %8s | %8s kB/h | %8s | %8s | %8s |" \
|
||||
$cmd $pid "${leak[pid]}" "${pattern[pid]}" $deltaR ${rss[pid]} ${firstR[pid]} ${lastR[pid]} $deltaP $pss ${firstP[pid]} ${lastP[pid]} >&1
|
||||
|
||||
lastP[pid]="$pss"
|
||||
leak[pid]="" # Resets the indicator in the 'Leak' column
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$leakFlag" -eq "1" ]; then memLeak leaking[@]; fi # Calls the mem leak function if flag is set
|
||||
if [ "$leakFlag" -eq "1" ]; then
|
||||
memLeak leaking[@];
|
||||
fi # Calls the mem leak function if flag is set
|
||||
unset leaking[@] # Clear the array holding PIDs of processes with potential leaks
|
||||
let leakFlag=0
|
||||
let hours+=1 # Hour count[pid]er used in calculating delta
|
||||
|
@ -30,24 +30,20 @@
|
||||
[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
|
||||
case "$1" in
|
||||
start)
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
if [ "$VERBOSE" != no ] ;then
|
||||
echo "System time was `date`."
|
||||
echo "Setting the System Clock using the Hardware Clock as reference..."
|
||||
fi
|
||||
|
||||
if [ "$HWCLOCKACCESS" != no ]
|
||||
then
|
||||
if [ -z "$TZ" ]
|
||||
then
|
||||
if [ "$HWCLOCKACCESS" != no ] ;then
|
||||
if [ -z "$TZ" ] ;then
|
||||
hwclock $tz --hctosys
|
||||
else
|
||||
TZ="$TZ" hwclock $tz --hctosys
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
echo "System Clock set. System local time is now `date`."
|
||||
fi
|
||||
;;
|
||||
@ -59,23 +55,19 @@ case "$1" in
|
||||
# WARNING: If you disable this, any changes to the system
|
||||
# clock will not be carried across reboots.
|
||||
#
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
echo "Saving the System Clock time to the Hardware Clock..."
|
||||
fi
|
||||
if [ "$HWCLOCKACCESS" != no ]
|
||||
then
|
||||
if [ "$HWCLOCKACCESS" != no ]; then
|
||||
hwclock $tz --systohc
|
||||
fi
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
echo "Hardware Clock updated to `date`."
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
show)
|
||||
if [ "$HWCLOCKACCESS" != no ]
|
||||
then
|
||||
if [ "$HWCLOCKACCESS" != no ]; then
|
||||
hwclock $tz --show
|
||||
fi
|
||||
;;
|
||||
|
@ -18,18 +18,18 @@ delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
||||
while true
|
||||
do
|
||||
|
||||
logger "$proc Stopping Platform Resource Agents ----------"
|
||||
crm resource stop $primary_resource
|
||||
for delay in $delay_list
|
||||
do
|
||||
logger "$proc Stopping Platform Resource Agents ----------"
|
||||
crm resource stop $primary_resource
|
||||
for delay in $delay_list
|
||||
do
|
||||
sleep 1
|
||||
echo -n "."
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
echo ""
|
||||
|
||||
status=`crm resource status`
|
||||
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
||||
do
|
||||
status=`crm resource status`
|
||||
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
||||
do
|
||||
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
|
||||
if [ "$status_tmp" != " Stopped " ] ; then
|
||||
echo "$proc ($count) Stop $service Failed <$status_tmp>"
|
||||
@ -39,21 +39,21 @@ do
|
||||
else
|
||||
echo "$proc ($count) Stop O.K. for $service"
|
||||
fi
|
||||
done
|
||||
logger "$proc Stop O.K. -------------------------------"
|
||||
done
|
||||
logger "$proc Stop O.K. -------------------------------"
|
||||
|
||||
logger "$proc Starting Platform Resource Agents ----------"
|
||||
crm resource start $primary_resource
|
||||
for delay in $delay_list
|
||||
do
|
||||
logger "$proc Starting Platform Resource Agents ----------"
|
||||
crm resource start $primary_resource
|
||||
for delay in $delay_list
|
||||
do
|
||||
sleep 1
|
||||
echo -n "."
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
echo ""
|
||||
|
||||
status=`crm resource status`
|
||||
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
||||
do
|
||||
status=`crm resource status`
|
||||
for service in "sysinv-api" "sysinv-conductor" "sysinv-agent" "mtcAgent" "hbsAgent"
|
||||
do
|
||||
status_tmp=`echo "$status" | grep $service | cut -f2 -d')'`
|
||||
if [ "$status_tmp" != " Started " ] ; then
|
||||
echo "$proc ($count) Start $service Failed <$status_tmp>"
|
||||
@ -63,11 +63,11 @@ do
|
||||
else
|
||||
echo "$proc ($count) Start O.K. for $service"
|
||||
fi
|
||||
done
|
||||
logger "$proc Start O.K. ------------------------------"
|
||||
done
|
||||
logger "$proc Start O.K. ------------------------------"
|
||||
|
||||
count=`expr $count + 1`
|
||||
mtc=`cat /var/run/mtcAgent.pid`
|
||||
hbs=`cat /var/run/hbsAgent.pid`
|
||||
echo "$mtc:`pidof mtcAgent` <:> $hbs:`pidof hbsAgent`"
|
||||
count=`expr $count + 1`
|
||||
mtc=`cat /var/run/mtcAgent.pid`
|
||||
hbs=`cat /var/run/hbsAgent.pid`
|
||||
echo "$mtc:`pidof mtcAgent` <:> $hbs:`pidof hbsAgent`"
|
||||
done
|
||||
|
@ -18,22 +18,22 @@ delay_list="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
||||
while true
|
||||
do
|
||||
|
||||
logger "$proc Swacting to Controller 1 ----------"
|
||||
crm resource move $primary_resource controller-1
|
||||
for delay in $delay_list
|
||||
do
|
||||
logger "$proc Swacting to Controller 1 ----------"
|
||||
crm resource move $primary_resource controller-1
|
||||
for delay in $delay_list
|
||||
do
|
||||
sleep 10
|
||||
echo -n "."
|
||||
crm status
|
||||
done
|
||||
done
|
||||
|
||||
logger "$proc Swacting to Controller 0 ----------"
|
||||
crm resource move $primary_resource controller-0
|
||||
for delay in $delay_list
|
||||
do
|
||||
logger "$proc Swacting to Controller 0 ----------"
|
||||
crm resource move $primary_resource controller-0
|
||||
for delay in $delay_list
|
||||
do
|
||||
sleep 10
|
||||
echo -n "."
|
||||
crm status
|
||||
done
|
||||
done
|
||||
|
||||
done
|
||||
|
@ -20,7 +20,7 @@ GENERIC_ERROR=1
|
||||
|
||||
NOVA_GOENABLED_TAG=${NOVA_GOENABLED_TAG:-"NOVA_GOENABLED"}
|
||||
|
||||
function log
|
||||
log()
|
||||
{
|
||||
logger -p local1.info -t ${NOVA_GOENABLED_TAG} $@
|
||||
}
|
||||
@ -32,22 +32,18 @@ NOVA_ADVANCE_ENABLED="/var/run/.nova_timer_advance_enabled"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_COMPUTE_SERVICES} ]
|
||||
then
|
||||
if [ -e ${VOLATILE_COMPUTE_CONFIG_COMPLETE} ] && [ ! -e ${VOLATILE_DISABLE_COMPUTE_SERVICES} ]; then
|
||||
log "Start"
|
||||
|
||||
if [ -e ${NOVA_INIT_FAILED} ]
|
||||
then
|
||||
if [ -e ${NOVA_INIT_FAILED} ]; then
|
||||
log "Nova-Init check FAILED"
|
||||
exit ${GENERIC_ERROR}
|
||||
fi
|
||||
|
||||
log "Nova-Init check PASSED"
|
||||
|
||||
while :
|
||||
do
|
||||
if [ -e ${NOVA_ADVANCE_ENABLED} ]
|
||||
then
|
||||
while [ true ]; do
|
||||
if [ -e ${NOVA_ADVANCE_ENABLED} ]; then
|
||||
log "Nova setup timer advance PASSED"
|
||||
break
|
||||
fi
|
||||
@ -55,10 +51,8 @@ case "$1" in
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while :
|
||||
do
|
||||
if [ -e ${NOVA_COMPUTE_ENABLED} ]
|
||||
then
|
||||
while [ true ]; do
|
||||
if [ -e ${NOVA_COMPUTE_ENABLED} ]; then
|
||||
log "Nova-Compute service enabled PASSED"
|
||||
break
|
||||
fi
|
||||
|
@ -9,7 +9,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||
|
||||
NAME=$(basename $0)
|
||||
|
||||
function LOG()
|
||||
LOG()
|
||||
{
|
||||
logger "$NAME: $*"
|
||||
}
|
||||
@ -47,8 +47,7 @@ REASONS=$(virt-host-validate qemu 2>/dev/null | grep -w -e FAIL)
|
||||
# - on emulated systems such as VirtualBox or QEMU, vmx is not required
|
||||
# - if vmx is enabled on QEMU, it can also support nested virtualization
|
||||
|
||||
if [ "${host_type}" = "physical" ] && [ "${hardware_virt_supported}" == "false" ]
|
||||
then
|
||||
if [ "${host_type}" = "physical" ] && [ "${hardware_virt_supported}" == "false" ]; then
|
||||
LOG "Virtualization is not supported: ${OPTS}. Failing goenabled check."
|
||||
LOG "Failure reasons:"$'\n'"${REASONS}"
|
||||
exit 1
|
||||
|
5
tox.ini
5
tox.ini
@ -14,6 +14,9 @@ deps = -r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:linters]
|
||||
whitelist_externals = bash
|
||||
#bashate ignore errors
|
||||
#E010: do not on the same line as for
|
||||
#E006 Line too long
|
||||
commands =
|
||||
bash -c "find {toxinidir} \
|
||||
-not \( -type d -name .?\* -prune \) \
|
||||
@ -21,7 +24,7 @@ commands =
|
||||
-not -name \*~ \
|
||||
-not -name \*.md \
|
||||
-name \*.sh \
|
||||
-print0 | xargs -0 bashate -v"
|
||||
-print0 | xargs -0 bashate -v -i E010,E006"
|
||||
bash -c "find {toxinidir} \
|
||||
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
|
||||
-o \( -name .tox -prune \) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user