Browse Source

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
changes/36/632136/2
Monty Taylor 6 months ago
parent
commit
3b9e295a37
No account linked to committer's email address
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      roles/merge-output-to-logs/tasks/main.yaml

+ 1
- 1
roles/merge-output-to-logs/tasks/main.yaml View File

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

Loading…
Cancel
Save