Skip to content

Commit

Permalink
Use the stat module instead of which
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwang committed Jan 27, 2021
1 parent cf035f5 commit 31e2286
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tasks/_inc_node_version.yml
Expand Up @@ -20,13 +20,9 @@
# if the client build is being executed independently, nodeenv may not be already installed.
# If so, setup a virtualenv with nodeenv installed.
- name: Check whether nodeenv is available
command: "which nodeenv"
environment:
PATH: "{{ galaxy_venv_dir }}/bin:{{ ansible_env.PATH }}"
VIRTUAL_ENV: "{{ galaxy_venv_dir }}"
register: nodeenv_exists
changed_when: nodeenv_exists.rc != 0
ignore_errors: true
stat:
path: "{{ galaxy_venv_dir }}/bin/nodeenv"
register: nodeenv_availability

- name: Setup nodeenv if required
block:
Expand All @@ -42,7 +38,7 @@
virtualenv_python: "{{ galaxy_virtualenv_python | default(omit) }}"
environment:
VIRTUAL_ENV: "{{ galaxy_venv_dir }}"
when: nodeenv_exists.rc != 0
when: not nodeenv_availability.stat.exists

rescue:

Expand Down

0 comments on commit 31e2286

Please sign in to comment.