From: Sébastien Han Date: Mon, 25 Jun 2018 16:12:05 +0000 (+0200) Subject: ceph-ansible-pr-syntax-check: fix grep error X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1053%2Fhead;p=ceph-build.git ceph-ansible-pr-syntax-check: fix grep error If grep fails the script exits because of the set -e so let's use || true to workaround that issue. Signed-off-by: Sébastien Han --- diff --git a/ceph-ansible-pr-syntax-check/build/build b/ceph-ansible-pr-syntax-check/build/build index 7eb6b2798..b5f77f5bc 100644 --- a/ceph-ansible-pr-syntax-check/build/build +++ b/ceph-ansible-pr-syntax-check/build/build @@ -30,13 +30,15 @@ function ansible_lint { } function group_vars_check { - nb="$(git show HEAD --name-only --pretty="" | grep -c '/defaults/main.yml')" + # we use || true so we still count and don't fail if we don't find anything + nb="$(git show HEAD --name-only --pretty="" | grep -c '/defaults/main.yml' || true)" if [[ "$nb" -eq 0 ]]; then echo "group_vars has not been touched." return 0 fi - nb_group_vars="$(git show HEAD --name-only --pretty="" | grep -c 'group_var/*')" + # we use || true so we still count and don't fail if we don't find anything + nb_group_vars="$(git show HEAD --name-only --pretty="" | grep -c 'group_var/*' || true)" if [[ "$nb" -ne "$nb_group_vars" ]]; then echo "One or more files containing default variables has/have been modified." echo "You must run 'generate_group_vars_sample.sh' to generate the group_vars template files."