1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix local port regex in listen_ports_facts (#4092)

* Fix local port regex

Thsi PR fix the bug reported in #4091

* Update changelogs/fragments/4092-fix_local_ports_regex_listen_ports_facts.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
gaetan-craft 2022-01-31 19:33:11 +01:00 committed by GitHub
parent 929136808f
commit 6a7811f696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- listen_ports_facts - local port regex was not handling well IPv6 only binding. Fixes the regex for ``ss`` (https://github.com/ansible-collections/community.general/pull/4092).

View file

@ -197,7 +197,7 @@ def netStatParse(raw):
def ss_parse(raw): def ss_parse(raw):
results = list() results = list()
regex_conns = re.compile(pattern=r'\[?(.+?)\]?:([0-9]+)') regex_conns = re.compile(pattern=r'\[?(.+?)\]?:([0-9]+)$')
regex_pid = re.compile(pattern=r'"(.*?)",pid=(\d+)') regex_pid = re.compile(pattern=r'"(.*?)",pid=(\d+)')
lines = raw.splitlines() lines = raw.splitlines()