Fix tox linters for zuul

Fix bashate and yamllint to only run if files are provided
Fix whitespace errors and line errors in shell scripts
Relax line length requirement in yamllint
Enable voting on zuul jobs
Story: 2003359
Task: 24409

Change-Id: I6bfa31c9a0c1527c6517cfd95758feadd73c0ae6
Signed-off-by: Lachlan Plant <lachlan.plant@windriver.com>
This commit is contained in:
Lachlan Plant 2018-08-29 11:30:50 -05:00
parent 50caaef062
commit e2137f94df
5 changed files with 37 additions and 44 deletions

View File

@ -1,5 +1,5 @@
- project:
check:
jobs:
- openstack-tox-linters:
voting: false
- openstack-tox-linters
- openstack-tox-pep8

View File

@ -178,8 +178,7 @@ fi
get_install_package() {
# The URL parameter is required for this function
if [ -z "$1" ]
then
if [ -z "$1" ] ; then
return 1
fi
@ -205,8 +204,7 @@ get_install_package() {
}
boot_at_startup () {
if [ -z "$1" ]
then
if [ -z "$1" ] ; then
echo "A URL parameter must be passed to boot_at_startup"
return 1
fi
@ -243,8 +241,7 @@ if [[ "$_java" ]]; then
echo "Elasticsearch recommends that you use the Oracle JDK version 1.8.0_73."
echo "Refer to the current documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html"
read -p "Would you like to install Oracle Java 8? y/n: " PACKMAN_CONTINUE_INPUT
while [[ "$PACKMAN_CONTINUE_INPUT" != "y" && "$PACKMAN_CONTINUE_INPUT" != "n" ]]
do
while [[ "$PACKMAN_CONTINUE_INPUT" != "y" && "$PACKMAN_CONTINUE_INPUT" != "n" ]] ; do
echo invalid input: $PACKMAN_CONTINUE_INPUT
read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT
done
@ -355,15 +352,15 @@ config_logstash() {
port_in_use=$( netstat -an | grep 10514 )
if [ -f "/bin/systemctl" ] ; then
systemctl enable iptables
systemctl enable iptables
else
update-rc.d iptables defaults 95 10
update-rc.d iptables defaults 95 10
fi
netstat -an | grep 10514
# Delete any pre-existing rules forwarding to port 10514
old_rules_list=$(iptables -t nat --line-numbers -L | grep '^[0-9].*10514' | awk '{ print $1 }' | tac)
old_rules_count=0
for i in $old_rules_list; do
for i in $old_rules_list ; do
iptables -t nat -D PREROUTING $i
old_rules_count=$((old_rules_count+1))
done

View File

@ -71,8 +71,8 @@ ip=""
suffix=""
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Directory that this script is contained in
if [ $UID -ne 0 ]; then
echo $'\tWarning: This script must be run as \'root\' user to restart ELK services. Please rerun with sudo.\n'
exit 1
echo $'\tWarning: This script must be run as \'root\' user to restart ELK services. Please rerun with sudo.\n'
exit 1
fi
# Check to see if required config files are present
if [[ ! -f "/etc/logstash/conf.d/wrs-logstash.conf" ]]; then

View File

@ -90,8 +90,7 @@ if [ -z "${VIRTUAL_ENV}" ]; then
echo "Please ensure the following are installed on your system before continuing:"
echo "python-dev python-setuptools gcc git python-pip"
read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT
while [[ "$PACKMAN_CONTINUE_INPUT" != "y" && "$PACKMAN_CONTINUE_INPUT" != "n" ]]
do
while [[ "$PACKMAN_CONTINUE_INPUT" != "y" && "$PACKMAN_CONTINUE_INPUT" != "n" ]] ; do
echo invalid input: $PACKMAN_CONTINUE_INPUT
read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT
done
@ -120,18 +119,19 @@ if ! pip install "pbr>=1.8"; then
exit 1
fi
while true;do echo -n . 1>&3;sleep 1;done &
while true; do
echo -n . 1>&3
sleep 1
done &
trap 'kill $! 2>/dev/null' EXIT
for file in *.tgz
do
for file in *.tgz ; do
if ! tar -zxf $file; then
echo "Failed to extract file $file" 1>&3
exit 1
fi
done
if [ -f "requirements.txt" ]
then
if [ -f "requirements.txt" ] ; then
if ! pip -q install -r requirements.txt -c upper_constraints.txt; then
echo "Failed to install requirements" 1>&3
exit 1
@ -145,17 +145,17 @@ echo [DONE] 1>&3
# because some of our tis clients are older than the most recent openstack clients
pip freeze | grep -wF -f installed_clients.txt | xargs pip uninstall -y
for dir in ./*/
do
for dir in ./*/ ; do
cd $dir
if [ -f "setup.py" ]
then
if [ -f "setup.py" ] ; then
echo -n Installing $(python setup.py --name) ... 1>&3
fi
while true;do echo -n . 1>&3;sleep 1;done &
if [ -f "requirements.txt" ]
then
while true; do
echo -n . 1>&3
sleep 1
done &
if [ -f "requirements.txt" ] ; then
grep -vwF -f ../installed_clients.txt requirements.txt > requirements.txt.temp
mv requirements.txt.temp requirements.txt
sed -i -e 's/# Apache-2.0//g' requirements.txt
@ -165,8 +165,7 @@ do
fi
fi
if [ -f "setup.py" ]
then
if [ -f "setup.py" ] ; then
if ! python setup.py -q install; then
echo "Failed to install $(python setup.py --name)" 1>&3
exit 1
@ -174,14 +173,11 @@ do
fi
# install bash completion
if [ -d "tools" -a -z "${VIRTUAL_ENV}" ]
then
if [ -d "tools" -a -z "${VIRTUAL_ENV}" ] ; then
cd tools
if [ -d "/etc/bash_completion.d" ]
then
if [ -d "/etc/bash_completion.d" ] ; then
count=`ls -1 *.bash_completion 2>/dev/null | wc -l`
if [ $count != 0 ]
then
if [ $count != 0 ] ; then
cp *.bash_completion /etc/bash_completion.d
fi
fi

View File

@ -20,7 +20,7 @@ commands =
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
-print0 | xargs -0 bashate -v"
-print0 | xargs -0 bashate -iE006 -v"
bash -c "find {toxinidir} \
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
-o \( -name .tox -prune \) \