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: - project:
check: check:
jobs: jobs:
- openstack-tox-linters: - openstack-tox-linters
voting: false - openstack-tox-pep8

View File

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

View File

@ -71,8 +71,8 @@ ip=""
suffix="" suffix=""
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Directory that this script is contained in DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Directory that this script is contained in
if [ $UID -ne 0 ]; then if [ $UID -ne 0 ]; then
echo $'\tWarning: This script must be run as \'root\' user to restart ELK services. Please rerun with sudo.\n' echo $'\tWarning: This script must be run as \'root\' user to restart ELK services. Please rerun with sudo.\n'
exit 1 exit 1
fi fi
# Check to see if required config files are present # Check to see if required config files are present
if [[ ! -f "/etc/logstash/conf.d/wrs-logstash.conf" ]]; then 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 "Please ensure the following are installed on your system before continuing:"
echo "python-dev python-setuptools gcc git python-pip" echo "python-dev python-setuptools gcc git python-pip"
read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT
while [[ "$PACKMAN_CONTINUE_INPUT" != "y" && "$PACKMAN_CONTINUE_INPUT" != "n" ]] while [[ "$PACKMAN_CONTINUE_INPUT" != "y" && "$PACKMAN_CONTINUE_INPUT" != "n" ]] ; do
do
echo invalid input: $PACKMAN_CONTINUE_INPUT echo invalid input: $PACKMAN_CONTINUE_INPUT
read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT
done done
@ -120,18 +119,19 @@ if ! pip install "pbr>=1.8"; then
exit 1 exit 1
fi 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 trap 'kill $! 2>/dev/null' EXIT
for file in *.tgz for file in *.tgz ; do
do
if ! tar -zxf $file; then if ! tar -zxf $file; then
echo "Failed to extract file $file" 1>&3 echo "Failed to extract file $file" 1>&3
exit 1 exit 1
fi fi
done done
if [ -f "requirements.txt" ] if [ -f "requirements.txt" ] ; then
then
if ! pip -q install -r requirements.txt -c upper_constraints.txt; then if ! pip -q install -r requirements.txt -c upper_constraints.txt; then
echo "Failed to install requirements" 1>&3 echo "Failed to install requirements" 1>&3
exit 1 exit 1
@ -145,17 +145,17 @@ echo [DONE] 1>&3
# because some of our tis clients are older than the most recent openstack clients # 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 pip freeze | grep -wF -f installed_clients.txt | xargs pip uninstall -y
for dir in ./*/ for dir in ./*/ ; do
do
cd $dir cd $dir
if [ -f "setup.py" ] if [ -f "setup.py" ] ; then
then
echo -n Installing $(python setup.py --name) ... 1>&3 echo -n Installing $(python setup.py --name) ... 1>&3
fi fi
while true;do echo -n . 1>&3;sleep 1;done & while true; do
if [ -f "requirements.txt" ] echo -n . 1>&3
then sleep 1
done &
if [ -f "requirements.txt" ] ; then
grep -vwF -f ../installed_clients.txt requirements.txt > requirements.txt.temp grep -vwF -f ../installed_clients.txt requirements.txt > requirements.txt.temp
mv requirements.txt.temp requirements.txt mv requirements.txt.temp requirements.txt
sed -i -e 's/# Apache-2.0//g' requirements.txt sed -i -e 's/# Apache-2.0//g' requirements.txt
@ -165,8 +165,7 @@ do
fi fi
fi fi
if [ -f "setup.py" ] if [ -f "setup.py" ] ; then
then
if ! python setup.py -q install; then if ! python setup.py -q install; then
echo "Failed to install $(python setup.py --name)" 1>&3 echo "Failed to install $(python setup.py --name)" 1>&3
exit 1 exit 1
@ -174,14 +173,11 @@ do
fi fi
# install bash completion # install bash completion
if [ -d "tools" -a -z "${VIRTUAL_ENV}" ] if [ -d "tools" -a -z "${VIRTUAL_ENV}" ] ; then
then
cd tools cd tools
if [ -d "/etc/bash_completion.d" ] if [ -d "/etc/bash_completion.d" ] ; then
then
count=`ls -1 *.bash_completion 2>/dev/null | wc -l` count=`ls -1 *.bash_completion 2>/dev/null | wc -l`
if [ $count != 0 ] if [ $count != 0 ] ; then
then
cp *.bash_completion /etc/bash_completion.d cp *.bash_completion /etc/bash_completion.d
fi fi
fi fi

View File

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