From c0a6aaf855f5994605d46d8d2b5def5d194bec2b Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Thu, 17 Aug 2017 20:10:51 +0200 Subject: [TOOL-5002] performance enhancement to reduce number of dirs/files to check --- include/tests_tooling | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'include/tests_tooling') diff --git a/include/tests_tooling b/include/tests_tooling index 26eee608..64debcde 100644 --- a/include/tests_tooling +++ b/include/tests_tooling @@ -54,10 +54,13 @@ # Ansible FOUND=0 - LIST="~/.ansible ~/.ansible-retry ${ROOTDIR}etc/ansible ${ROOTDIR}root/.ansible ${ROOTDIR}tmp/.ansible" - for ITEM in ${LIST}; do if DirectoryExists ${ITEM}; then FOUND=1; fi; done - LIST="${ROOTDIR}var/log/ansible.log" - for ITEM in ${LIST}; do if FileExists ${ITEM}; then FOUND=1; fi; done + LIST="~/.ansible ${ROOTDIR}etc/ansible ${ROOTDIR}root/.ansible ${ROOTDIR}tmp/.ansible" + for ITEM in ${LIST}; do if DirectoryExists ${ITEM}; then FOUND=1; break; fi; done + # Test for files (only if no match was found) + if [ ${FOUND} -eq 0 ]; then + LIST="${ROOTDIR}var/log/ansible.log ~/.ansible-retry" + for ITEM in ${LIST}; do if FileExists ${ITEM}; then FOUND=1; break; fi; done + fi if [ ${FOUND} -eq 1 ]; then LogText "Result: found a possible trace of Ansible" -- cgit v1.2.3