From f9cd3fedb1ce16ace1e40569c8bbedca3f08a8df Mon Sep 17 00:00:00 2001 From: Jack Meixensperger Date: Fri, 19 Apr 2024 10:15:34 -0700 Subject: [PATCH 1/3] check stdout defined --- roles/splunk_common/tasks/install_python_requirements.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/splunk_common/tasks/install_python_requirements.yml b/roles/splunk_common/tasks/install_python_requirements.yml index 8d10246a..b5b8e8b0 100644 --- a/roles/splunk_common/tasks/install_python_requirements.yml +++ b/roles/splunk_common/tasks/install_python_requirements.yml @@ -20,9 +20,13 @@ - 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) From c7006f111d14ee45ca9a7b91776ed5a646ad6634 Mon Sep 17 00:00:00 2001 From: Jack Meixensperger Date: Fri, 19 Apr 2024 10:20:51 -0700 Subject: [PATCH 2/3] update remaining tasks --- roles/splunk_common/tasks/install_python_requirements.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/splunk_common/tasks/install_python_requirements.yml b/roles/splunk_common/tasks/install_python_requirements.yml index b5b8e8b0..e73384f7 100644 --- a/roles/splunk_common/tasks/install_python_requirements.yml +++ b/roles/splunk_common/tasks/install_python_requirements.yml @@ -9,12 +9,12 @@ 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 From 1b0c4fb128b05ff92b105bce5d0f67aff73458c3 Mon Sep 17 00:00:00 2001 From: Jack Meixensperger Date: Fri, 19 Apr 2024 10:38:45 -0700 Subject: [PATCH 3/3] delete paren close --- roles/splunk_common/tasks/install_python_requirements.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/splunk_common/tasks/install_python_requirements.yml b/roles/splunk_common/tasks/install_python_requirements.yml index e73384f7..a33f9b79 100644 --- a/roles/splunk_common/tasks/install_python_requirements.yml +++ b/roles/splunk_common/tasks/install_python_requirements.yml @@ -22,11 +22,11 @@ name: "requests_unixsocket" when: - requests_unixsocket_check.stdout is defined - - requests_unixsocket_check.stdout | length == 0 or requests_unixsocket_check.stdout.find("requests-unixsocket") == -1) + - 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.stdout is defined - - requests_unixsocket_check_py3.stdout | length == 0 or requests_unixsocket_check_py3.stdout.find("requests-unixsocket") == -1) + - requests_unixsocket_check_py3.stdout | length == 0 or requests_unixsocket_check_py3.stdout.find("requests-unixsocket") == -1