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:
parent
50caaef062
commit
e2137f94df
|
@ -1,5 +1,5 @@
|
|||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-linters:
|
||||
voting: false
|
||||
- openstack-tox-linters
|
||||
- openstack-tox-pep8
|
||||
|
|
|
@ -164,7 +164,7 @@ elif [[ ! -z $APT_GET_CMD ]]; then
|
|||
fi
|
||||
if $install_curl ; then
|
||||
echo "curl is required for Elasticsearch package download."
|
||||
apt-get install curl
|
||||
apt-get install curl
|
||||
fi
|
||||
if $install_iptables_save; then
|
||||
echo "iptables-persistent is required for Logstash with protected ports under 1024."
|
||||
|
@ -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
|
||||
|
@ -263,7 +260,7 @@ if [[ "$install_java" == "y" ]]; then
|
|||
apt-get install oracle-java8-set-default
|
||||
else
|
||||
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jre-8u92-linux-x64.rpm"
|
||||
yum localinstall jre-8u92-linux-x64.rpm
|
||||
yum localinstall jre-8u92-linux-x64.rpm
|
||||
fi
|
||||
echo "Java installation complete."
|
||||
fi
|
||||
|
@ -282,7 +279,7 @@ wait_for_elasticsearch() {
|
|||
break 2
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [ "$ES_ACTIVE" == false ]; then
|
||||
echo "Elasticsearch is not responding. Please resolve the issue and rerun the script."
|
||||
echo "More details at: https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html"
|
||||
|
@ -333,7 +330,7 @@ config_logstash() {
|
|||
# Update conf file with IP_ADDRESS
|
||||
sed -i "s/ host => .*/ host => \"${IP_ADDRESS}\"/" /etc/logstash/conf.d/wrs-logstash.conf
|
||||
sed -i "s/.*elasticsearch { hosts.*/ elasticsearch { hosts => [\"${IP_ADDRESS}:9200\"] }/" /etc/logstash/conf.d/wrs-logstash.conf
|
||||
|
||||
|
||||
# install certificate, key, and set TLS config
|
||||
if [ $TLS_PARAM_COUNT -eq 2 ]; then
|
||||
mkdir -p /etc/pki/tls/certs
|
||||
|
@ -355,20 +352,20 @@ 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
|
||||
echo Deleted $old_rules_count NAT PREROUTING rules to Logstash listening authorized port 10514.
|
||||
|
||||
|
||||
# Update conf file with non-priviledged port
|
||||
echo "Priviledged port $PORT redirected to Logstash listening authorized port 10514."
|
||||
sed -i "s/ port =>.*/ port => 10514/" /etc/logstash/conf.d/wrs-logstash.conf
|
||||
|
@ -395,7 +392,7 @@ config_logstash() {
|
|||
netfilter-persistent save
|
||||
netfilter-persistent reload
|
||||
elif [ -f "/etc/init.d/iptables-persistent" ] ; then
|
||||
/etc/init.d/iptables-persistent save
|
||||
/etc/init.d/iptables-persistent save
|
||||
/etc/init.d/iptables-persistent reload
|
||||
elif [ -f "/etc/centos-release" ] ; then
|
||||
# CentOS 7 https://wiki.centos.org/HowTos/Network/IPTables
|
||||
|
|
|
@ -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
|
||||
|
@ -139,7 +139,7 @@ function help {
|
|||
echo " originally used when setting up ELK to work with a remote logger."
|
||||
echo " -If you use the --remote option and logs fail to populate, or you get an error about elasticsearch"
|
||||
echo " make sure that the port your remote logger is using is still being forwarded correctly by re-entering"
|
||||
echo " iptables -t nat -A PREROUTING -p UDP -m udp --dport $PORT -j REDIRECT --to-ports 10514"
|
||||
echo " iptables -t nat -A PREROUTING -p UDP -m udp --dport $PORT -j REDIRECT --to-ports 10514"
|
||||
echo " OR"
|
||||
echo " ip6tables -t nat -A PREROUTING -p tcp -m tcp --dport $PORT -j REDIRECT --to-ports 10514"
|
||||
echo " make sure you correctly specify tcp or udp, and use iptables for IPV4 and ip6tables for IPV6"
|
||||
|
@ -259,7 +259,7 @@ dist="$(lsb_release -a)"
|
|||
while [[ $# > 0 ]]; do
|
||||
arg="$1"
|
||||
case $arg in
|
||||
|
||||
|
||||
-h|--help)
|
||||
help
|
||||
;;
|
||||
|
|
|
@ -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
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -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 \) \
|
||||
|
|
Loading…
Reference in New Issue