From 30941b19e4217e54bb37c79ece1f3e09e1e94227 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Mon, 25 Jun 2018 18:12:05 +0200 Subject: [PATCH] ceph-ansible-pr-syntax-check: fix grep error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- ceph-ansible-pr-syntax-check/build/build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ceph-ansible-pr-syntax-check/build/build b/ceph-ansible-pr-syntax-check/build/build index 7eb6b279..b5f77f5b 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." -- 2.39.5