]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-ansible-pr-syntax-check: fix grep error 1053/head
authorSébastien Han <seb@redhat.com>
Mon, 25 Jun 2018 16:12:05 +0000 (18:12 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 25 Jun 2018 16:13:48 +0000 (18:13 +0200)
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 <seb@redhat.com>
ceph-ansible-pr-syntax-check/build/build

index 7eb6b2798bba1233a672aecc091a13a17715aaae..b5f77f5bc3bb29ac337cc6eb1f7d7c954e30259f 100644 (file)
@@ -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."