Skip to content

Commit

Permalink
Merge pull request #822 from splunk/unixsocket-conditions
Browse files Browse the repository at this point in the history
fix conditionals for python requirements
  • Loading branch information
jmeixensperger authored Apr 24, 2024
2 parents 199cbb2 + 1b0c4fb commit f56fb9f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions roles/splunk_common/tasks/install_python_requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@
name: pip
extra_args: --upgrade
executable: pip3
when: requests_unixsocket_check is failed
when: requests_unixsocket_check.stdout is undefined

- name: Check if pip3 unixsocket exits
command: "pip3 list | grep 'requests-unixsocket'"
register: requests_unixsocket_check_py3
when: requests_unixsocket_check is failed
when: requests_unixsocket_check.stdout is undefined
ignore_errors: true

- name: Install missing requests_unixsocket
ansible.builtin.pip:
name: "requests_unixsocket"
when: requests_unixsocket_check is succeeded and (requests_unixsocket_check.stdout | length == 0 or requests_unixsocket_check.stdout.find("requests-unixsocket") == -1)
when:
- requests_unixsocket_check.stdout is defined
- requests_unixsocket_check.stdout | length == 0 or requests_unixsocket_check.stdout.find("requests-unixsocket") == -1

- name: Install missing requests_unixsocket PY3
ansible.builtin.pip:
name: "requests_unixsocket"
when: requests_unixsocket_check_py3 is succeeded and (requests_unixsocket_check_py3.stdout | length == 0 or requests_unixsocket_check_py3.stdout.find("requests-unixsocket") == -1)
when:
- requests_unixsocket_check_py3.stdout is defined
- requests_unixsocket_check_py3.stdout | length == 0 or requests_unixsocket_check_py3.stdout.find("requests-unixsocket") == -1

0 comments on commit f56fb9f

Please sign in to comment.