[PR #10458/fe59c6d2 backport][stable-10] listen_ports_facts: Avoid crash when required commands are missing (#10475)

listen_ports_facts: Avoid crash when required commands are missing (#10458)

* Fix listen-port-facts crash

* Update changelog

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



* Fix sanity tests

* Update changelogs/fragments/10458-listen_port_facts-prevent-type-error.yml



---------


(cherry picked from commit fe59c6d29e)

Co-authored-by: Giorgos Drosos <56369797+gdrosos@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2025-07-27 12:13:07 +02:00 committed by GitHub
commit 4412bdba9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 1 deletions

View file

@ -397,7 +397,7 @@ def main():
break
if bin_path is None:
raise EnvironmentError(msg='Unable to find any of the supported commands in PATH: {0}'.format(", ".join(sorted(commands_map))))
raise EnvironmentError('Unable to find any of the supported commands in PATH: {0}'.format(", ".join(sorted(commands_map))))
# which ports are listening for connections?
args = commands_map[command]['args']