Skip to content

Commit

Permalink
Use find instead of ls in command (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitounator authored Oct 25, 2022
1 parent d9aaf4a commit 3b3b46a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
- nuget-group
- nuget-hosted
- nuget.org-proxy
when: (nexus_data_dir_contents.stdout | length == 0) and nexus_delete_default_repos
when: (nexus_data_dir_contents.matched == 0) and nexus_delete_default_repos

- name: Deleting default blobstore
include_tasks: delete_blobstore_each.yml
Expand All @@ -72,7 +72,7 @@
| list
| unique
}}
when: (nexus_data_dir_contents.stdout | length == 0) and nexus_delete_default_blobstore
when: (nexus_data_dir_contents.matched == 0) and nexus_delete_default_blobstore

- block:
- include_tasks: setup_ldap_each.yml
Expand Down
10 changes: 8 additions & 2 deletions tasks/nexus_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,13 @@
when: nexus_backup_configure | bool

- name: 'Check if data directory is empty (first-time install)'
command: "ls --ignore=lost+found {{ nexus_data_dir }}"
find:
paths:
- "{{ nexus_data_dir }}"
excludes:
- lost+found
recurse: no
file_type: any
register: nexus_data_dir_contents
check_mode: no
changed_when: false
Expand All @@ -390,7 +396,7 @@
file:
path: "{{ nexus_data_dir }}/clean_cache"
state: touch
when: nexus_latest_version.changed and nexus_data_dir_contents.stdout | length > 0
when: nexus_latest_version.changed and nexus_data_dir_contents.matched > 0
tags:
# hard to run as a handler for time being
- skip_ansible_lint
Expand Down

0 comments on commit 3b3b46a

Please sign in to comment.