From 2f03cf35e51ff4fabcf2f9e4111f0bdeca1e3464 Mon Sep 17 00:00:00 2001 From: K Jonathan Harker Date: Mon, 29 Sep 2014 13:28:19 -0700 Subject: [PATCH] Clean up bashate failures Also create tools/run-bashate.sh to wrap a find command to search for files to run bashate on, and use it in tox. Change-Id: I5ab07425f566a556f158a4b76b00aa35f9fb4385 --- jenkins/scripts/bump-milestone.sh | 27 ++++--- jenkins/scripts/common_translation_update.sh | 78 +++++++------------ jenkins/scripts/create-ppa-package.sh | 19 ++--- jenkins/scripts/gerrit-git-prep.sh | 44 ++++------- jenkins/scripts/jenkins-sudo-grep.sh | 63 +++++++-------- jenkins/scripts/php-laravel-build.sh | 2 +- jenkins/scripts/propose_translation_update.sh | 30 ++++--- ...ranslation_update_django_openstack_auth.sh | 3 +- .../propose_translation_update_manuals.sh | 6 +- jenkins/scripts/run-tarball.sh | 15 ++-- jenkins/scripts/run-tox.sh | 17 ++-- jenkins/scripts/run-unittests.sh | 12 +-- jenkins/scripts/run-wheel.sh | 11 ++- ...tream_translation_django_openstack_auth.sh | 6 +- .../scripts/upstream_translation_horizon.sh | 6 +- .../scripts/upstream_translation_update.sh | 6 +- .../upstream_translation_update_manuals.sh | 6 +- jenkins/scripts/wait_for_puppet.sh | 7 +- nodepool/scripts/convert_node_to_xenserver.sh | 60 +++++++------- nodepool/scripts/fix_pip.sh | 2 +- .../scripts/install_devstack_dependencies.sh | 8 +- nodepool/scripts/prepare_node.sh | 3 +- nodepool/scripts/prepare_tripleo.sh | 8 +- .../xenserver_helper_initramfs_hook.sh | 2 +- .../xenserver_helper_initramfs_premount.sh | 3 +- tools/run-bashate.sh | 4 + tox.ini | 2 +- zuul/layout.yaml | 2 - 28 files changed, 192 insertions(+), 260 deletions(-) create mode 100755 tools/run-bashate.sh diff --git a/jenkins/scripts/bump-milestone.sh b/jenkins/scripts/bump-milestone.sh index 8ee90b1888..4f579038d9 100644 --- a/jenkins/scripts/bump-milestone.sh +++ b/jenkins/scripts/bump-milestone.sh @@ -12,7 +12,7 @@ GIT_HOST="review.openstack.org:29418" PROJECT_PREFIX="openstack" if [[ ! -e ${PROJECT} ]]; then - git clone ssh://$GIT_HOST/$PROJECT_PREFIX/$PROJECT + git clone ssh://$GIT_HOST/$PROJECT_PREFIX/$PROJECT fi cd $PROJECT git checkout master @@ -23,15 +23,15 @@ git fetch origin +refs/meta/*:refs/remotes/meta/* # Checkout or create the meta/openstack/release branch if ! { git branch -a |grep ^[[:space:]]*remotes/meta/openstack/release$; } then - git checkout --orphan release - # Delete everything so the first commit is truly empty: - git rm -rf . - # git rm -rf leaves submodule directories: - find -maxdepth 1 -not -regex '\./\.git\(/.*\)?' -not -name . -exec rm -fr {} \; - ls -la + git checkout --orphan release + # Delete everything so the first commit is truly empty: + git rm -rf . + # git rm -rf leaves submodule directories: + find -maxdepth 1 -not -regex '\./\.git\(/.*\)?' -not -name . -exec rm -fr {} \; + ls -la else - git branch -D release || /bin/true - git checkout -b release remotes/meta/openstack/release + git branch -D release || /bin/true + git checkout -b release remotes/meta/openstack/release fi # Normally a branch name will just be a file, but we can have branches @@ -40,12 +40,11 @@ fi mkdir -p `dirname $BRANCH` # Read and update the value for the branch -if [ -e "$BRANCH" ] -then - echo "Current contents of ${BRANCH}:" - cat "${BRANCH}" +if [ -e "$BRANCH" ]; then + echo "Current contents of ${BRANCH}:" + cat "${BRANCH}" else - echo "${BRANCH} does not exist. Creating it." + echo "${BRANCH} does not exist. Creating it." fi echo "Updating ${BRANCH} to read $VALUE" diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh index 25110b2448..c93a781faf 100644 --- a/jenkins/scripts/common_translation_update.sh +++ b/jenkins/scripts/common_translation_update.sh @@ -15,8 +15,7 @@ # under the License. # Initial transifex setup -function setup_translation () -{ +function setup_translation { # Track in HAS_CONFIG whether we run "tx init" since calling it # will add the file .tx/config - and "tx set" might update it. If # "tx set" updates .tx/config, we need to handle the file if it @@ -31,8 +30,7 @@ function setup_translation () } # Setup a project for transifex -function setup_project () -{ +function setup_project { local project=$1 # Transifex project name does not include "." @@ -45,8 +43,7 @@ function setup_project () } # Setup project horizon for transifex -function setup_horizon () -{ +function setup_horizon { local project=horizon # Horizon JavaScript Translations @@ -72,8 +69,7 @@ function setup_horizon () } # Set global variable DocFolder for manuals projects -function init_manuals () -{ +function init_manuals { project=$1 DocFolder="doc" @@ -84,46 +80,38 @@ function init_manuals () # Setup project manuals projects (api-site, openstack-manuals, # operations-guide) for transifex -function setup_manuals () -{ +function setup_manuals { local project=$1 # Generate pot one by one - for FILE in ${DocFolder}/* - do + for FILE in ${DocFolder}/*; do # Skip non-directories - if [ ! -d $FILE ] - then + if [ ! -d $FILE ]; then continue fi DOCNAME=${FILE#${DocFolder}/} # Ignore directories that will not get translated - if [ "$DOCNAME" == "www" -o "$DOCNAME" == "tools" -o "$DOCNAME" == "generated" -o "$DOCNAME" == "publish-docs" ] - then + if [ "$DOCNAME" == "www" -o "$DOCNAME" == "tools" -o "$DOCNAME" == "generated" -o "$DOCNAME" == "publish-docs" ]; then continue fi # Skip glossary in all repos besides openstack-manuals. - if [ "$project" != "openstack-manuals" -a "$DOCNAME" == "glossary" ] - then + if [ "$project" != "openstack-manuals" -a "$DOCNAME" == "glossary" ]; then continue fi # Minimum amount of translation done, 75 % by default. PERC=75 - if [ "$project" == "openstack-manuals" ] - then + if [ "$project" == "openstack-manuals" ]; then # The common and glossary directories are used by the # other guides, let's be more liberal here since teams # might only translate the files used by a single # guide. We use 8 % since that downloads the currently # translated files. - if [ "$DOCNAME" == "common" -o "$DOCNAME" == "glossary" ] - then + if [ "$DOCNAME" == "common" -o "$DOCNAME" == "glossary" ]; then PERC=8 fi fi # Update the .pot file ./tools/generatepot ${DOCNAME} - if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ] - then + if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]; then # Add all changed files to git git add ${DocFolder}/${DOCNAME}/locale/* # Set auto-local @@ -138,8 +126,7 @@ function setup_manuals () } # Setup git so that git review works -function setup_git () -{ +function setup_git { git config user.name "OpenStack Proposal Bot" git config user.email "openstack-infra@lists.openstack.org" git config gitreview.username "proposal-bot" @@ -147,8 +134,7 @@ function setup_git () # Setup project so that git review works, sets global variable # COMMIT_MSG. -function setup_review () -{ +function setup_review { FULL_PROJECT=$(grep project .gitreview | cut -f2 -d= |sed -e 's/\.git$//') COMMIT_MSG="Imported Translations from Transifex" @@ -199,19 +185,16 @@ EOF } # Propose patch using COMMIT_MSG -function send_patch () -{ +function send_patch { # Revert any changes done to .tx/config - if [ $HAS_CONFIG -eq 1 ] - then + if [ $HAS_CONFIG -eq 1 ]; then git reset -q .tx/config git checkout -- .tx/config fi # Don't send a review if nothing has changed. - if [ `git diff --cached |wc -l` -gt 0 ] - then + if [ `git diff --cached |wc -l` -gt 0 ]; then # Commit and review git commit -F- </LC_MESSAGES/django.po" \ --source-lang en \ @@ -284,11 +262,9 @@ function setup_django_openstack_auth () } # Filter out files that we do not want to commit -function filter_commits () -{ +function filter_commits { # Don't add new empty files. - for f in `git diff --cached --name-only --diff-filter=A` - do + for f in `git diff --cached --name-only --diff-filter=A`; do # Files should have at least one non-empty msgid string. if ! grep -q 'msgid "[^"]' "$f" ; then git reset -q "$f" @@ -301,16 +277,14 @@ function filter_commits () # comment lines, or diff file information. # Also, don't send files if only .pot files would be changed. PO_CHANGE=0 - for f in `git diff --cached --name-only` - do + for f in `git diff --cached --name-only`; do # It's ok if the grep fails set +e changed=$(git diff --cached "$f" \ | egrep -v "(POT-Creation-Date|Project-Id-Version|PO-Revision-Date)" \ | egrep -c "^([-+][^-+#])") set -e - if [ $changed -eq 0 ] - then + if [ $changed -eq 0 ]; then git reset -q "$f" git checkout -- "$f" # Check for all files endig with ".po" diff --git a/jenkins/scripts/create-ppa-package.sh b/jenkins/scripts/create-ppa-package.sh index 49b2376c6e..828533c0ad 100755 --- a/jenkins/scripts/create-ppa-package.sh +++ b/jenkins/scripts/create-ppa-package.sh @@ -1,9 +1,8 @@ #!/bin/bash -xe -if [ -z "$PROJECT" ] -then - echo '$PROJECT not set.' - exit 1 +if [ -z "$PROJECT" ]; then + echo '$PROJECT not set.' + exit 1 fi case "$ZUUL_REFNAME" in @@ -33,8 +32,7 @@ tarball="$(echo dist/$PROJECT*.tar.gz)" version="${tarball%.tar.gz}" version="${version#*$PROJECT-}" base_version=$version -if [ -n "${EXTRAVERSION}" ] -then +if [ -n "${EXTRAVERSION}" ]; then version="${version%~*}${EXTRAVERSION}~${version#*~}" fi tar xvzf "${tarball}" @@ -50,8 +48,7 @@ ln -s "${tarball}" "${PROJECT}_${version}.orig.tar.gz" echo bzr checkout -r ${PACKAGING_REVNO} --lightweight $BZR_BRANCH $PROJECT-* bzr checkout -r ${PACKAGING_REVNO} --lightweight $BZR_BRANCH $PROJECT-* cd $PROJECT-* -if [ -d .git ] -then +if [ -d .git ]; then PACKAGING_REVNO="$(git log --oneline | wc -l)" rm -rf .git else @@ -68,10 +65,8 @@ buildno=$BUILD_NUMBER pkgversion="${version}-0ubuntu0~${series}${buildno}" dch -b --force-distribution --v "${pkgversion}" "Automated PPA build. Packaging revision: ${PACKAGING_REVNO}." -D $series dpkg-buildpackage -rfakeroot -S -sa -nc -k32EE128C -if ! [ "$DO_UPLOAD" = "no" ] -then - for ppa in $PPAS - do +if ! [ "$DO_UPLOAD" = "no" ]; then + for ppa in $PPAS; do dput --force $ppa "../${PROJECT}_${pkgversion}_source.changes" done fi diff --git a/jenkins/scripts/gerrit-git-prep.sh b/jenkins/scripts/gerrit-git-prep.sh index 8b0c8b86fb..e5857f587c 100755 --- a/jenkins/scripts/gerrit-git-prep.sh +++ b/jenkins/scripts/gerrit-git-prep.sh @@ -3,29 +3,24 @@ GERRIT_SITE=$1 GIT_ORIGIN=$2 -if [ -z "$GERRIT_SITE" ] -then - echo "The gerrit site name (eg 'https://review.openstack.org') must be the first argument." - exit 1 +if [ -z "$GERRIT_SITE" ]; then + echo "The gerrit site name (eg 'https://review.openstack.org') must be the first argument." + exit 1 fi -if [ -z "$ZUUL_URL" ] -then - echo "The ZUUL_URL must be provided." - exit 1 +if [ -z "$ZUUL_URL" ]; then + echo "The ZUUL_URL must be provided." + exit 1 fi -if [ -z "$GIT_ORIGIN" ] || [ -n "$ZUUL_NEWREV" ] -then +if [ -z "$GIT_ORIGIN" ] || [ -n "$ZUUL_NEWREV" ]; then GIT_ORIGIN="$GERRIT_SITE/p" # git://git.openstack.org/ # https://review.openstack.org/p fi -if [ -z "$ZUUL_REF" ] -then - if [ -n "$BRANCH" ] - then +if [ -z "$ZUUL_REF" ]; then + if [ -n "$BRANCH" ]; then echo "No ZUUL_REF so using requested branch $BRANCH from origin." ZUUL_REF=$BRANCH # use the origin since zuul mergers have outdated branches @@ -36,18 +31,15 @@ then fi fi -if [ ! -z "$ZUUL_CHANGE" ] -then +if [ ! -z "$ZUUL_CHANGE" ]; then echo "Triggered by: $GERRIT_SITE/$ZUUL_CHANGE" fi set -x -if [[ ! -e .git ]] -then +if [[ ! -e .git ]]; then ls -a rm -fr .[^.]* * - if [ -d /opt/git/$ZUUL_PROJECT/.git ] - then + if [ -d /opt/git/$ZUUL_PROJECT/.git ]; then git clone file:///opt/git/$ZUUL_PROJECT . else git clone $GIT_ORIGIN/$ZUUL_PROJECT . @@ -56,8 +48,7 @@ fi git remote set-url origin $GIT_ORIGIN/$ZUUL_PROJECT # attempt to work around bugs 925790 and 1229352 -if ! git remote update -then +if ! git remote update; then echo "The remote update failed, so garbage collecting before trying again." git gc git remote update @@ -69,13 +60,11 @@ if ! git clean -x -f -d -q ; then git clean -x -f -d -q fi -if echo "$ZUUL_REF" | grep -q ^refs/tags/ -then +if echo "$ZUUL_REF" | grep -q ^refs/tags/; then git fetch --tags $ZUUL_URL/$ZUUL_PROJECT git checkout $ZUUL_REF git reset --hard $ZUUL_REF -elif [ -z "$ZUUL_NEWREV" ] -then +elif [ -z "$ZUUL_NEWREV" ]; then git fetch $ZUUL_URL/$ZUUL_PROJECT $ZUUL_REF git checkout FETCH_HEAD git reset --hard FETCH_HEAD @@ -89,8 +78,7 @@ if ! git clean -x -f -d -q ; then git clean -x -f -d -q fi -if [ -f .gitmodules ] -then +if [ -f .gitmodules ]; then git submodule init git submodule sync git submodule update --init diff --git a/jenkins/scripts/jenkins-sudo-grep.sh b/jenkins/scripts/jenkins-sudo-grep.sh index 4b6e4c319a..dfbf4670ec 100755 --- a/jenkins/scripts/jenkins-sudo-grep.sh +++ b/jenkins/scripts/jenkins-sudo-grep.sh @@ -20,43 +20,40 @@ case $( facter osfamily ) in Debian) - PATTERN="sudo.*jenkins.*:.*incorrect password attempts" - OLDLOGFILE=/var/log/auth.log.1 - LOGFILE=/var/log/auth.log - ;; + PATTERN="sudo.*jenkins.*:.*incorrect password attempts" + OLDLOGFILE=/var/log/auth.log.1 + LOGFILE=/var/log/auth.log + ;; RedHat) - PATTERN="sudo.*jenkins.*:.*command not allowed" - OLDLOGFILE=$( ls /var/log/secure-* | sort | tail -n1 ) - LOGFILE=/var/log/secure - ;; + PATTERN="sudo.*jenkins.*:.*command not allowed" + OLDLOGFILE=$( ls /var/log/secure-* | sort | tail -n1 ) + LOGFILE=/var/log/secure + ;; esac case "$1" in pre) - rm -fr /tmp/jenkins-sudo-log - mkdir /tmp/jenkins-sudo-log - if [ -f $OLDLOGFILE ] - then - stat -c %Y $OLDLOGFILE > /tmp/jenkins-sudo-log/mtime-pre - else - echo "0" > /tmp/jenkins-sudo-log/mtime-pre - fi - grep -h "$PATTERN" $LOGFILE > /tmp/jenkins-sudo-log/pre - exit 0 - ;; + rm -fr /tmp/jenkins-sudo-log + mkdir /tmp/jenkins-sudo-log + if [ -f $OLDLOGFILE ]; then + stat -c %Y $OLDLOGFILE > /tmp/jenkins-sudo-log/mtime-pre + else + echo "0" > /tmp/jenkins-sudo-log/mtime-pre + fi + grep -h "$PATTERN" $LOGFILE > /tmp/jenkins-sudo-log/pre + exit 0 + ;; post) - if [ -f $OLDLOGFILE ] - then - stat -c %Y $OLDLOGFILE > /tmp/jenkins-sudo-log/mtime-post - else - echo "0" > /tmp/jenkins-sudo-log/mtime-post - fi - if ! diff /tmp/jenkins-sudo-log/mtime-pre /tmp/jenkins-sudo-log/mtime-post > /dev/null - then - echo "diff" - grep -h "$PATTERN" $OLDLOGFILE > /tmp/jenkins-sudo-log/post - fi - grep -h "$PATTERN" $LOGFILE >> /tmp/jenkins-sudo-log/post - diff /tmp/jenkins-sudo-log/pre /tmp/jenkins-sudo-log/post - ;; + if [ -f $OLDLOGFILE ]; then + stat -c %Y $OLDLOGFILE > /tmp/jenkins-sudo-log/mtime-post + else + echo "0" > /tmp/jenkins-sudo-log/mtime-post + fi + if ! diff /tmp/jenkins-sudo-log/mtime-pre /tmp/jenkins-sudo-log/mtime-post > /dev/null; then + echo "diff" + grep -h "$PATTERN" $OLDLOGFILE > /tmp/jenkins-sudo-log/post + fi + grep -h "$PATTERN" $LOGFILE >> /tmp/jenkins-sudo-log/post + diff /tmp/jenkins-sudo-log/pre /tmp/jenkins-sudo-log/post + ;; esac diff --git a/jenkins/scripts/php-laravel-build.sh b/jenkins/scripts/php-laravel-build.sh index f8e6fca59a..12fe169249 100644 --- a/jenkins/scripts/php-laravel-build.sh +++ b/jenkins/scripts/php-laravel-build.sh @@ -9,4 +9,4 @@ cat >bootstrap/environment.php < $f.sha1 - cat $f.sha1 +for f in $FILES; do + echo "SHA1sum for $f:" + sha1sum $f | awk '{print $1}' > $f.sha1 + cat $f.sha1 - echo "MD5sum for $f:" - md5sum $f | awk '{print $1}' > $f.md5 - cat $f.md5 + echo "MD5sum for $f:" + md5sum $f | awk '{print $1}' > $f.md5 + cat $f.md5 done diff --git a/jenkins/scripts/run-tox.sh b/jenkins/scripts/run-tox.sh index a25aee4a56..34cf24bd42 100755 --- a/jenkins/scripts/run-tox.sh +++ b/jenkins/scripts/run-tox.sh @@ -13,12 +13,11 @@ venv=$1 -if [[ -z "$venv" ]] -then - echo "Usage: $?" - echo - echo "VENV: The tox environment to run (eg 'python27')" - exit 1 +if [[ -z "$venv" ]]; then + echo "Usage: $?" + echo + echo "VENV: The tox environment to run (eg 'python27')" + exit 1 fi cat /etc/image-hostname.txt @@ -33,8 +32,7 @@ result=$? sudo /usr/local/jenkins/slave_scripts/jenkins-sudo-grep.sh post sudoresult=$? -if [ $sudoresult -ne "0" ] -then +if [ $sudoresult -ne "0" ]; then echo echo "This test has failed because it attempted to execute commands" echo "with sudo. See above for the exact commands used." @@ -45,8 +43,7 @@ fi /usr/local/jenkins/slave_scripts/jenkins-oom-grep.sh post oomresult=$? -if [ $oomresult -ne "0" ] -then +if [ $oomresult -ne "0" ]; then echo echo "This test has failed because it attempted to exceed configured" echo "memory limits and was killed prior to completion. See above" diff --git a/jenkins/scripts/run-unittests.sh b/jenkins/scripts/run-unittests.sh index 91ed4af802..dfd4584795 100755 --- a/jenkins/scripts/run-unittests.sh +++ b/jenkins/scripts/run-unittests.sh @@ -69,8 +69,7 @@ fi sudo /usr/local/jenkins/slave_scripts/jenkins-sudo-grep.sh post sudoresult=$? -if [ $sudoresult -ne "0" ] -then +if [ $sudoresult -ne "0" ]; then echo echo "This test has failed because it attempted to execute commands" echo "with sudo. See above for the exact commands used." @@ -81,8 +80,7 @@ fi /usr/local/jenkins/slave_scripts/jenkins-oom-grep.sh post oomresult=$? -if [ $oomresult -ne "0" ] -then +if [ $oomresult -ne "0" ]; then echo echo "This test has failed because it attempted to exceed configured" echo "memory limits and was killed prior to completion. See above" @@ -92,11 +90,9 @@ then fi htmlreport=$(find . -name $NOSE_HTML_OUT_FILE) -if [ -f "$htmlreport" ] -then +if [ -f "$htmlreport" ]; then passcount=$(grep -c 'tr class=.passClass' $htmlreport) - if [ $passcount -eq "0" ] - then + if [ $passcount -eq "0" ]; then echo echo "Zero tests passed, which probably means there was an error" echo "parsing one of the python files, or that some other failure" diff --git a/jenkins/scripts/run-wheel.sh b/jenkins/scripts/run-wheel.sh index c46e762733..648e11f750 100644 --- a/jenkins/scripts/run-wheel.sh +++ b/jenkins/scripts/run-wheel.sh @@ -19,11 +19,10 @@ tox -evenv pip install wheel tox -evenv python setup.py bdist_wheel FILES=dist/*.whl -for f in $FILES -do - echo -n "SHA1sum for $f: " - sha1sum $f | awk '{print $1}' | tee $f.sha1 +for f in $FILES; do + echo -n "SHA1sum for $f: " + sha1sum $f | awk '{print $1}' | tee $f.sha1 - echo -n "MD5sum for $f: " - md5sum $f | awk '{print $1}' | tee $f.md5 + echo -n "MD5sum for $f: " + md5sum $f | awk '{print $1}' | tee $f.md5 done diff --git a/jenkins/scripts/upstream_translation_django_openstack_auth.sh b/jenkins/scripts/upstream_translation_django_openstack_auth.sh index 79b19dad92..8a6d374bee 100755 --- a/jenkins/scripts/upstream_translation_django_openstack_auth.sh +++ b/jenkins/scripts/upstream_translation_django_openstack_auth.sh @@ -16,8 +16,7 @@ # The script is to push the updated English po to Transifex. -if [ ! `echo $ZUUL_REFNAME | grep master` ] -then +if [ ! `echo $ZUUL_REFNAME | grep master` ]; then exit 0 fi @@ -34,8 +33,7 @@ python setup.py extract_messages # Add all changed files to git git add openstack_auth/locale/* -if [ ! `git diff-index --quiet HEAD --` ] -then +if [ ! `git diff-index --quiet HEAD --` ]; then # Push .pot changes to transifex tx --debug --traceback push -s fi diff --git a/jenkins/scripts/upstream_translation_horizon.sh b/jenkins/scripts/upstream_translation_horizon.sh index b144f10c28..75b5b59b83 100755 --- a/jenkins/scripts/upstream_translation_horizon.sh +++ b/jenkins/scripts/upstream_translation_horizon.sh @@ -18,8 +18,7 @@ PROJECT="horizon" -if [ ! `echo $ZUUL_REFNAME | grep master` ] -then +if [ ! `echo $ZUUL_REFNAME | grep master` ]; then exit 0 fi @@ -38,8 +37,7 @@ setup_horizon git add ${PROJECT}/locale/en/LC_MESSAGES/* git add openstack_dashboard/locale/en/LC_MESSAGES/* -if [ `git diff --cached | egrep -v "(POT-Creation-Date|^[\+\-]#|^\+{3}|^\-{3})" | egrep -c "^[\-\+]"` -gt 0 ] -then +if [ `git diff --cached | egrep -v "(POT-Creation-Date|^[\+\-]#|^\+{3}|^\-{3})" | egrep -c "^[\-\+]"` -gt 0 ]; then # Push source file changes to transifex tx --debug --traceback push -s fi diff --git a/jenkins/scripts/upstream_translation_update.sh b/jenkins/scripts/upstream_translation_update.sh index 35bf29ab57..0b906fc7f0 100755 --- a/jenkins/scripts/upstream_translation_update.sh +++ b/jenkins/scripts/upstream_translation_update.sh @@ -14,8 +14,7 @@ PROJECT=$1 -if [ ! `echo $ZUUL_REFNAME | grep master` ] -then +if [ ! `echo $ZUUL_REFNAME | grep master` ]; then exit 0 fi @@ -33,8 +32,7 @@ extract_messages_log "$PROJECT" # Add all changed files to git git add $PROJECT/locale/* -if [ ! `git diff-index --quiet HEAD --` ] -then +if [ ! `git diff-index --quiet HEAD --` ]; then # Push .pot changes to transifex # Transifex project name does not include "." diff --git a/jenkins/scripts/upstream_translation_update_manuals.sh b/jenkins/scripts/upstream_translation_update_manuals.sh index 80e41d9e74..f12f9bfa0b 100755 --- a/jenkins/scripts/upstream_translation_update_manuals.sh +++ b/jenkins/scripts/upstream_translation_update_manuals.sh @@ -18,8 +18,7 @@ PROJECT=$1 -if [ ! `echo $ZUUL_REFNAME | grep master` ] -then +if [ ! `echo $ZUUL_REFNAME | grep master` ]; then exit 0 fi @@ -32,8 +31,7 @@ setup_translation setup_manuals "$PROJECT" -if [ ! `git diff --cached --quiet HEAD --` ] -then +if [ ! `git diff --cached --quiet HEAD --` ]; then # Push .pot changes to transifex tx --debug --traceback push -s fi diff --git a/jenkins/scripts/wait_for_puppet.sh b/jenkins/scripts/wait_for_puppet.sh index 9812a15a98..47a884c66f 100755 --- a/jenkins/scripts/wait_for_puppet.sh +++ b/jenkins/scripts/wait_for_puppet.sh @@ -12,9 +12,10 @@ echo "Jenkins: Waiting for puppet to complete on all nodes" DONE=0 while [ $DONE != 1 ]; do DONE=1 - for hostname in $HOSTS - do - if !(grep "$hostname $FINISH_RE" $LOGFILE >/dev/null); then DONE=0; fi + for hostname in $HOSTS; do + if !(grep "$hostname $FINISH_RE" $LOGFILE >/dev/null); then + DONE=0 + fi done sleep 5 done diff --git a/nodepool/scripts/convert_node_to_xenserver.sh b/nodepool/scripts/convert_node_to_xenserver.sh index 5a39d5e678..4e328fb51d 100755 --- a/nodepool/scripts/convert_node_to_xenserver.sh +++ b/nodepool/scripts/convert_node_to_xenserver.sh @@ -88,7 +88,7 @@ DOMZERO_USER=domzero # directory to ramdisk. XSINST_DIRECTORY="/xsinst" -function main() { +function main { case "$(get_state)" in "START") dump_disk_config @@ -146,7 +146,7 @@ function main() { esac } -function set_state() { +function set_state { local state state="$1" @@ -154,7 +154,7 @@ function set_state() { echo "$state" > $STATE_FILE } -function get_state() { +function get_state { if [ -e "$STATE_FILE" ]; then cat $STATE_FILE else @@ -162,7 +162,7 @@ function get_state() { fi } -function create_resizing_initramfs_config() { +function create_resizing_initramfs_config { cp "$THIS_DIR/xenserver_helper_initramfs_hook.sh" \ /usr/share/initramfs-tools/hooks/resize chmod +x /usr/share/initramfs-tools/hooks/resize @@ -172,12 +172,12 @@ function create_resizing_initramfs_config() { chmod +x /usr/share/initramfs-tools/scripts/local-premount/resize } -function delete_resizing_initramfs_config() { +function delete_resizing_initramfs_config { rm -f /usr/share/initramfs-tools/hooks/resize rm -f /usr/share/initramfs-tools/scripts/local-premount/resize } -function run_this_script_on_each_boot() { +function run_this_script_on_each_boot { cat > /etc/init/xenserver.conf << EOF start on stopped rc RUNLEVEL=[2345] @@ -189,13 +189,13 @@ end script EOF } -function create_done_file_on_appliance() { +function create_done_file_on_appliance { while ! echo "sudo touch $FILE_TO_TOUCH_ON_COMPLETION" | bash_on_appliance; do sleep 1 done } -function download_xenserver_files() { +function download_xenserver_files { local tgt tgt="$1" @@ -203,7 +203,7 @@ function download_xenserver_files() { wget -qO "$tgt" "$XENSERVER_ISO_URL" } -function download_appliance() { +function download_appliance { local appliance_url appliance_url="$1" @@ -211,7 +211,7 @@ function download_appliance() { wget -qO /root/staging_vm.xva "$appliance_url" } -function print_answerfile() { +function print_answerfile { local repository local postinst local xenserver_pass @@ -238,7 +238,7 @@ function print_answerfile() { EOF } -function print_postinst_file() { +function print_postinst_file { local rclocal rclocal="$1" @@ -252,7 +252,7 @@ cp /tmp/ramdisk/authorized_keys \$1/root/.ssh/ EOF } -function print_rclocal() { +function print_rclocal { cat << EOF # This is the contents of the rc.local file on XenServer mkdir -p /mnt/ubuntu @@ -263,7 +263,7 @@ mkdir -p $(dirname $INSTALL_DIR) EOF } -function create_ramdisk_contents() { +function create_ramdisk_contents { local isofile local target_dir @@ -280,7 +280,7 @@ function create_ramdisk_contents() { "$XENSERVER_PASSWORD" > "$target_dir/answerfile.xml" } -function extract_xs_installer() { +function extract_xs_installer { local isofile local targetpath @@ -300,7 +300,7 @@ function extract_xs_installer() { umount $mountdir } -function generate_xs_installer_grub_config() { +function generate_xs_installer_grub_config { local bootfiles local answerfile @@ -319,7 +319,7 @@ EOF chmod +x /etc/grub.d/45_xs-install } -function configure_grub() { +function configure_grub { sed -ie 's/^GRUB_HIDDEN_TIMEOUT/#GRUB_HIDDEN_TIMEOUT/g' /etc/default/grub sed -ie 's/^GRUB_HIDDEN_TIMEOUT_QUIET/#GRUB_HIDDEN_TIMEOUT_QUIET/g' /etc/default/grub # sed -ie 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=-1/g' /etc/default/grub @@ -327,11 +327,11 @@ function configure_grub() { sed -ie 's/GRUB_DEFAULT=0/GRUB_DEFAULT=saved/g' /etc/default/grub } -function set_xenserver_installer_as_nextboot() { +function set_xenserver_installer_as_nextboot { grub-set-default "XenServer installer" } -function store_cloud_settings() { +function store_cloud_settings { local targetpath targetpath="$1" @@ -345,7 +345,7 @@ NAMESERVERS=$(cat /etc/resolv.conf | grep nameserver | cut -d " " -f 2 | sort | EOF } -function store_authorized_keys() { +function store_authorized_keys { local targetpath targetpath="$1" @@ -353,13 +353,13 @@ function store_authorized_keys() { cp /root/.ssh/authorized_keys $1 } -function wait_for_xapi() { +function wait_for_xapi { while ! [ -e /var/run/xapi_init_complete.cookie ]; do sleep 1 done } -function forget_networking() { +function forget_networking { xe host-management-disable IFS=, for vlan in $(xe vlan-list --minimal); do @@ -374,7 +374,7 @@ function forget_networking() { unset IFS } -function add_boot_config_for_ubuntu() { +function add_boot_config_for_ubuntu { local ubuntu_bootfiles local bootfiles @@ -398,7 +398,7 @@ label ubuntu UBUNTU } -function start_ubuntu_on_next_boot() { +function start_ubuntu_on_next_boot { local bootfiles bootfiles="$1" @@ -406,7 +406,7 @@ function start_ubuntu_on_next_boot() { sed -ie 's,default xe-serial,default ubuntu,g' $bootfiles/extlinux.conf } -function start_xenserver_on_next_boot() { +function start_xenserver_on_next_boot { local bootfiles bootfiles="$1" @@ -414,7 +414,7 @@ function start_xenserver_on_next_boot() { sed -ie 's,default ubuntu,default xe-serial,g' $bootfiles/extlinux.conf } -function mount_dom0_fs() { +function mount_dom0_fs { local target target="$1" @@ -423,13 +423,13 @@ function mount_dom0_fs() { mount /dev/xvda2 $target } -function wait_for_networking() { +function wait_for_networking { while ! ping -c 1 xenserver.org > /dev/null 2>&1; do sleep 1 done } -function bash_on_appliance() { +function bash_on_appliance { local vm_ip local vm @@ -452,7 +452,7 @@ function bash_on_appliance() { "$DOMZERO_USER@$vm_ip" bash -e -u -s -x -- "$@" } -function configure_networking() { +function configure_networking { local network_settings network_settings="$1" @@ -576,7 +576,7 @@ EOF cat $tmpdomzerokey >> /root/.ssh/authorized_keys } -function transfer_settings_to_appliance() { +function transfer_settings_to_appliance { local network_settings network_settings="$1" @@ -585,7 +585,7 @@ function transfer_settings_to_appliance() { /opt/xensource/libexec/interface-reconfigure rewrite } -function dump_disk_config() { +function dump_disk_config { echo "DUMPING Primary disk's configuration" sfdisk -d /dev/xvda } diff --git a/nodepool/scripts/fix_pip.sh b/nodepool/scripts/fix_pip.sh index 019dc54fe8..8c171355bd 100755 --- a/nodepool/scripts/fix_pip.sh +++ b/nodepool/scripts/fix_pip.sh @@ -25,6 +25,6 @@ done # install pip using get-pip PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py if [ ! -f get-pip.py ] ; then - curl -O $PIP_GET_PIP_URL || wget $PIP_GET_PIP_URL + curl -O $PIP_GET_PIP_URL || wget $PIP_GET_PIP_URL fi sudo python get-pip.py diff --git a/nodepool/scripts/install_devstack_dependencies.sh b/nodepool/scripts/install_devstack_dependencies.sh index 9e1c20907b..87d55ddc00 100755 --- a/nodepool/scripts/install_devstack_dependencies.sh +++ b/nodepool/scripts/install_devstack_dependencies.sh @@ -21,12 +21,12 @@ mkdir -p ~/cache/pip if [ -f /usr/bin/yum ]; then sudo yum -y install python-devel make automake gcc gcc-c++ \ - kernel-devel redhat-lsb-core + kernel-devel redhat-lsb-core elif [ -f /usr/bin/apt-get ]; then sudo DEBIAN_FRONTEND=noninteractive apt-get \ - --option "Dpkg::Options::=--force-confold" \ - --assume-yes install build-essential python-dev \ - python-software-properties linux-headers-virtual linux-headers-`uname -r` + --option "Dpkg::Options::=--force-confold" \ + --assume-yes install build-essential python-dev \ + python-software-properties linux-headers-virtual linux-headers-`uname -r` else echo "Unsupported distro." exit 1 diff --git a/nodepool/scripts/prepare_node.sh b/nodepool/scripts/prepare_node.sh index 4877538898..bad93b3365 100755 --- a/nodepool/scripts/prepare_node.sh +++ b/nodepool/scripts/prepare_node.sh @@ -28,8 +28,7 @@ GIT_BASE=${GIT_BASE:-git://git.openstack.org} export PUPPET_VERSION=${PUPPET_VERSION:-'2'} sudo hostname $HOSTNAME -if [ -n "$HOSTNAME" ] && ! grep -q $HOSTNAME /etc/hosts -then +if [ -n "$HOSTNAME" ] && ! grep -q $HOSTNAME /etc/hosts ; then echo "127.0.1.1 $HOSTNAME" | sudo tee -a /etc/hosts fi diff --git a/nodepool/scripts/prepare_tripleo.sh b/nodepool/scripts/prepare_tripleo.sh index fdfd962235..2fa23e947d 100755 --- a/nodepool/scripts/prepare_tripleo.sh +++ b/nodepool/scripts/prepare_tripleo.sh @@ -20,7 +20,7 @@ # Enable precise-backports so we can install jq if [ -f /usr/bin/apt-get ]; then sudo sed -i -e 's/# \(deb .*precise-backports main \)/\1/g' \ - /etc/apt/sources.list + /etc/apt/sources.list sudo apt-get update fi @@ -37,7 +37,7 @@ sudo pip install gear os-apply-config # tests. if [ -d /etc/sysconfig/network-scripts ]; then - sudo dd of=/etc/sysconfig/network-scripts/ifcfg-eth1 << EOF + sudo dd of=/etc/sysconfig/network-scripts/ifcfg-eth1 << EOF DEVICE="eth1" BOOTPROTO="dhcp" ONBOOT="yes" @@ -46,13 +46,13 @@ PEERDNS="no" EOF elif [ -f /etc/network/interfaces ]; then - sudo dd of=/etc/network/interfaces oflag=append conv=notrunc << EOF + sudo dd of=/etc/network/interfaces oflag=append conv=notrunc << EOF auto eth1 iface eth1 inet dhcp EOF # Workaround bug 1270646 for actual slaves - sudo dd of=/etc/network/interfaces.d/eth0.cfg oflag=append conv=notrunc << EOF + sudo dd of=/etc/network/interfaces.d/eth0.cfg oflag=append conv=notrunc << EOF post-up ip link set mtu 1458 dev eth0 EOF diff --git a/nodepool/scripts/xenserver_helper_initramfs_hook.sh b/nodepool/scripts/xenserver_helper_initramfs_hook.sh index 328b197cdf..6ce9d4477a 100644 --- a/nodepool/scripts/xenserver_helper_initramfs_hook.sh +++ b/nodepool/scripts/xenserver_helper_initramfs_hook.sh @@ -4,7 +4,7 @@ set -e PREREQ="" -prereqs () { +function prereqs { echo "${PREREQ}" } diff --git a/nodepool/scripts/xenserver_helper_initramfs_premount.sh b/nodepool/scripts/xenserver_helper_initramfs_premount.sh index 3f7dc9b874..e17f37d436 100644 --- a/nodepool/scripts/xenserver_helper_initramfs_premount.sh +++ b/nodepool/scripts/xenserver_helper_initramfs_premount.sh @@ -5,8 +5,7 @@ set -ex PREREQ="" # Output pre-requisites -prereqs() -{ +function prereqs { echo "$PREREQ" } diff --git a/tools/run-bashate.sh b/tools/run-bashate.sh new file mode 100755 index 0000000000..3fdefe1b70 --- /dev/null +++ b/tools/run-bashate.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +ROOT=$(readlink -fn $(dirname $0)/.. ) +find $ROOT -not -wholename \*.tox/\* -and \( -name \*.sh -or -name \*rc -or -name functions\* \) -print0 | xargs -0 bashate -v diff --git a/tox.ini b/tox.ini index ce1f798e38..5dc0589e9c 100644 --- a/tox.ini +++ b/tox.ini @@ -48,4 +48,4 @@ commands = {toxinidir}/tools/run-layout.sh openstack-infra config [testenv:bashate] -commands = bashate -v +commands = {toxinidir}/tools/run-bashate.sh diff --git a/zuul/layout.yaml b/zuul/layout.yaml index 10265500c2..cd54b66179 100644 --- a/zuul/layout.yaml +++ b/zuul/layout.yaml @@ -780,8 +780,6 @@ jobs: voting: false - name: gate-config-bashate voting: false - - name: gate-project-config-bashate - voting: false # TODO(rpodolyaka): make voting when the jobs pass on all SA versions - name: gate-oslo.db-tox-sqla_08 voting: false