Use find instead of ls for determining dir emptiness

ls foo/* isn't a great way to do this - but find, as is usually
the case, solves all problems.

Change-Id: Ic30b36ccee41e9b74e187eb3cdab0359f659a1c9
This commit is contained in:
Monty Taylor 2019-01-21 17:16:53 +00:00
parent f711df6978
commit 3b9e295a37
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594

View File

@ -2,7 +2,7 @@
when: zuul.change is defined when: zuul.change is defined
delegate_to: localhost delegate_to: localhost
shell: | shell: |
if [ -n $(ls {{ zuul.executor.work_root }}/{{ item }}) ] ; then if [ -n "$(find {{ zuul.executor.work_root }}/{{ item }} -mindepth 1)" ] ; then
# Only create target directory if it is needed. # Only create target directory if it is needed.
# Do not fail if it is already there. # Do not fail if it is already there.
mkdir -p {{ zuul.executor.log_root }}/{{ item }} mkdir -p {{ zuul.executor.log_root }}/{{ item }}