Update tests/integration/targets/listen_ports_facts/tasks/main.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Giorgos Drosos 2025-07-25 22:07:21 +03:00 committed by GitHub
commit 7670f9b4df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -112,32 +112,30 @@
ignore_errors: true ignore_errors: true
- name: Remove netstat and ss dependencies to simulate missing executables - when: ansible_os_family == "Debian"
ansible.builtin.package: block:
name: - name: Remove netstat and ss dependencies to simulate missing executables
- net-tools ansible.builtin.package:
- iproute2 name:
state: absent - net-tools
ignore_errors: true - iproute2
when: ansible_os_family == "Debian" state: absent
ignore_errors: true
- name: Trigger listen_ports_facts with missing tools - name: Trigger listen_ports_facts with missing tools
community.general.listen_ports_facts: community.general.listen_ports_facts:
register: listen_ports_failure_result register: listen_ports_failure_result
ignore_errors: true ignore_errors: true
when: ansible_os_family == "Debian"
- name: Assert graceful failure when dependencies are missing - name: Assert graceful failure when dependencies are missing
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- listen_ports_failure_result.failed - listen_ports_failure_result is failed
- "'Unable to find any of the supported commands' in listen_ports_failure_result.msg" - "'Unable to find any of the supported commands' in listen_ports_failure_result.msg"
when: ansible_os_family == "Debian"
- name: Reinstall netstat and ss dependencies after test - name: Reinstall netstat and ss dependencies after test
ansible.builtin.package: ansible.builtin.package:
name: name:
- net-tools - net-tools
- iproute2 - iproute2
state: present state: present
when: ansible_os_family == "Debian"