Skip to content

Commit

Permalink
Fix local port regex in listen_ports_facts (#4092)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
gaetan-craft and felixfontein committed Jan 31, 2022
1 parent 9291368 commit 6a7811f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
@@ -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).
2 changes: 1 addition & 1 deletion plugins/modules/system/listen_ports_facts.py
Expand Up @@ -197,7 +197,7 @@ def netStatParse(raw):

def ss_parse(raw):
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+)')

lines = raw.splitlines()
Expand Down

0 comments on commit 6a7811f

Please sign in to comment.